{% set name = "PyInstaller" %}
# NOTE: the test step triggers antivirus stuff.  Let IT know that you're building a new pyinstaller release,
#    and that they should watch for hello.exe triggering alerts.  Windows jobs in particular will fail with
#    what looks like a permission error.
{% set version = "3.6" %}
{% set sha256 = "3730fa80d088f8bb7084d32480eb87cbb4ddb64123363763cf8f2a1378c1c4b7" %}

package:
  name: {{ name.lower() }}
  version: {{ version }}

source:
  fn: PyInstaller-{{ version }}.tar.bz2
  url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
  sha256: {{ sha256 }}
  patches:
    - 0001-depend-bindepend-find-statically-linked-libraries.patch
    - 0002-Bootloader-build-Fallback-to-a-default-min-macOS-ver.patch
    - 0003-hooks-Update-pkg_resources-hook-for-setuptools-v45.0.patch
    - 0004-Python-3.8-multiprocessing.resource_tracker-fix.patch

build:
  number: 6
  entry_points:
    - pyinstaller = PyInstaller.__main__:run
    - pyi-archive_viewer = PyInstaller.utils.cliutils.archive_viewer:run
    - pyi-bindepend = PyInstaller.utils.cliutils.bindepend:run
    - pyi-grab_version = PyInstaller.utils.cliutils.grab_version:run
    - pyi-makespec = PyInstaller.utils.cliutils.makespec:run
    - pyi-set_version = PyInstaller.utils.cliutils.set_version:run
  script:
    - export LDFLAGS="${LDFLAGS} -L${PREFIX}/lib"               # [unix]
    - export LDFLAGS="${LDFLAGS} -mmacosx-version-min=${macos_min_version}"  # [osx]
    # Remove the pre-compiled bootloaders (available in sdist)
    - rm -fr ${SRC_DIR}/PyInstaller/bootloader/{Darwin,Linux,Windows}-{64,32}bit  # [unix]
    - pushd bootloader
    - waf --prefix="${PREFIX}" --clang distclean all            # [osx]
    - waf --prefix="${PREFIX}" --gcc --no-lsb distclean all     # [linux]
    - waf --prefix="%LIBRARY_PREFIX%" distclean all             # [win]
    - popd
    - "{{ PYTHON }} -m pip install . --no-deps -vv"
  preserve_egg_dir: True
  ignore_run_exports:  # [win]
    - vc  # [win]
    - vs2015_runtime  # [win]

requirements:
  build:
    - {{ compiler("c") }}
    - pip
    - python
    - setuptools
    - m2-patch  # [win]
    - m2-gcc-libs  # [win]
    - patch  # [not win]
  host:
    - pip
    - python
    - setuptools
    - waf
    - zlib  # [not win]

  run:
    - altgraph
    - python
    - pefile >=2017.9.3  # [win]
    - pycryptodome
    - pywin32  # [win]
    - pywin32-ctypes  # [win]
    - dis3  # [py27]
    - macholib >=1.8
    - setuptools

test:
  imports:
    - PyInstaller

  commands:
    - pyinstaller --help
    - pyi-archive_viewer --help
    - pyi-bindepend --help
    - pyi-makespec --help
    # These are designed for Windows only.
    - pyi-grab_version --help     # [win]
    - pyi-set_version --help      # [win]

  files:
    - hello.py
    - multiprocessing_test.py

about:
  home: http://www.pyinstaller.org
  # https://github.com/pyinstaller/pyinstaller/blob/v3.6/COPYING.txt#L11
  license: GPL-2.0-or-later
  license_family: GPL
  license_file: COPYING.txt
  summary: PyInstaller bundles a Python application and all its dependencies into a single package.

extra:
  recipe-maintainers:
    - jakirkham
    - nicoddemus
    - hadim
    - nehaljwani
    - mingwandroid
