|
@@ -25,6 +25,7 @@ else:
|
|
|
|
|
|
from .copymodules import copy_modules
|
|
from .copymodules import copy_modules
|
|
from .nsiswriter import NSISFileWriter
|
|
from .nsiswriter import NSISFileWriter
|
|
|
|
+from .pypi import fetch_pypi_wheels
|
|
from .util import download, text_types, get_cache_dir
|
|
from .util import download, text_types, get_cache_dir
|
|
|
|
|
|
__version__ = '1.6'
|
|
__version__ = '1.6'
|
|
@@ -73,7 +74,9 @@ class InstallerBuilder(object):
|
|
in the config file
|
|
in the config file
|
|
:param str icon: Path to an icon for the application
|
|
:param str icon: Path to an icon for the application
|
|
:param list packages: List of strings for importable packages to include
|
|
:param list packages: List of strings for importable packages to include
|
|
|
|
+ :param list pypi_reqs: Package specifications to fetch from PyPI as wheels
|
|
:param list extra_files: List of 2-tuples (file, destination) of files to include
|
|
:param list extra_files: List of 2-tuples (file, destination) of files to include
|
|
|
|
+ :param list exclude: Paths of files to exclude that would otherwise be included
|
|
:param str py_version: Full version of Python to bundle
|
|
:param str py_version: Full version of Python to bundle
|
|
:param int py_bitness: Bitness of bundled Python (32 or 64)
|
|
:param int py_bitness: Bitness of bundled Python (32 or 64)
|
|
:param str build_dir: Directory to run the build in
|
|
:param str build_dir: Directory to run the build in
|
|
@@ -85,7 +88,7 @@ class InstallerBuilder(object):
|
|
py_bitness=DEFAULT_BITNESS, py_format='installer',
|
|
py_bitness=DEFAULT_BITNESS, py_format='installer',
|
|
build_dir=DEFAULT_BUILD_DIR,
|
|
build_dir=DEFAULT_BUILD_DIR,
|
|
installer_name=None, nsi_template=None,
|
|
installer_name=None, nsi_template=None,
|
|
- exclude=None):
|
|
|
|
|
|
+ exclude=None, pypi_wheel_reqs=None):
|
|
self.appname = appname
|
|
self.appname = appname
|
|
self.version = version
|
|
self.version = version
|
|
self.shortcuts = shortcuts
|
|
self.shortcuts = shortcuts
|
|
@@ -93,6 +96,7 @@ class InstallerBuilder(object):
|
|
self.packages = packages or []
|
|
self.packages = packages or []
|
|
self.exclude = [os.path.normpath(p) for p in (exclude or [])]
|
|
self.exclude = [os.path.normpath(p) for p in (exclude or [])]
|
|
self.extra_files = extra_files or []
|
|
self.extra_files = extra_files or []
|
|
|
|
+ self.pypi_wheel_reqs = pypi_wheel_reqs or []
|
|
|
|
|
|
# Python options
|
|
# Python options
|
|
self.py_version = py_version
|
|
self.py_version = py_version
|
|
@@ -321,10 +325,18 @@ if __name__ == '__main__':
|
|
build_pkg_dir = pjoin(self.build_dir, 'pkgs')
|
|
build_pkg_dir = pjoin(self.build_dir, 'pkgs')
|
|
if os.path.isdir(build_pkg_dir):
|
|
if os.path.isdir(build_pkg_dir):
|
|
shutil.rmtree(build_pkg_dir)
|
|
shutil.rmtree(build_pkg_dir)
|
|
|
|
+
|
|
|
|
+ # 1. Manually prepared packages
|
|
if os.path.isdir('pynsist_pkgs'):
|
|
if os.path.isdir('pynsist_pkgs'):
|
|
shutil.copytree('pynsist_pkgs', build_pkg_dir)
|
|
shutil.copytree('pynsist_pkgs', build_pkg_dir)
|
|
else:
|
|
else:
|
|
os.mkdir(build_pkg_dir)
|
|
os.mkdir(build_pkg_dir)
|
|
|
|
+
|
|
|
|
+ # 2. Wheels from PyPI
|
|
|
|
+ fetch_pypi_wheels(self.pypi_wheel_reqs, build_pkg_dir,
|
|
|
|
+ py_version=self.py_version, bitness=self.py_bitness)
|
|
|
|
+
|
|
|
|
+ # 3. Copy importable modules
|
|
copy_modules(self.packages, build_pkg_dir,
|
|
copy_modules(self.packages, build_pkg_dir,
|
|
py_version=self.py_version, exclude=self.exclude)
|
|
py_version=self.py_version, exclude=self.exclude)
|
|
|
|
|
|
@@ -479,6 +491,7 @@ def main(argv=None):
|
|
icon = appcfg.get('icon', DEFAULT_ICON),
|
|
icon = appcfg.get('icon', DEFAULT_ICON),
|
|
shortcuts = shortcuts,
|
|
shortcuts = shortcuts,
|
|
packages = cfg.get('Include', 'packages', fallback='').splitlines(),
|
|
packages = cfg.get('Include', 'packages', fallback='').splitlines(),
|
|
|
|
+ pypi_wheel_reqs = cfg.get('Include', 'pypi_wheels', fallback='').splitlines(),
|
|
extra_files = configreader.read_extra_files(cfg),
|
|
extra_files = configreader.read_extra_files(cfg),
|
|
py_version = cfg.get('Python', 'version', fallback=DEFAULT_PY_VERSION),
|
|
py_version = cfg.get('Python', 'version', fallback=DEFAULT_PY_VERSION),
|
|
py_bitness = cfg.getint('Python', 'bitness', fallback=DEFAULT_BITNESS),
|
|
py_bitness = cfg.getint('Python', 'bitness', fallback=DEFAULT_BITNESS),
|