|
@@ -26,7 +26,7 @@ from .nsiswriter import NSISFileWriter
|
|
|
from .pypi import fetch_pypi_wheels
|
|
|
from .util import download, text_types, get_cache_dir
|
|
|
|
|
|
-__version__ = '2.1'
|
|
|
+__version__ = '2.2'
|
|
|
|
|
|
pjoin = os.path.join
|
|
|
logger = logging.getLogger(__name__)
|
|
@@ -96,7 +96,7 @@ class InstallerBuilder(object):
|
|
|
py_format='bundled', inc_msvcrt=True, build_dir=DEFAULT_BUILD_DIR,
|
|
|
installer_name=None, nsi_template=None,
|
|
|
exclude=None, pypi_wheel_reqs=None, extra_wheel_sources=None,
|
|
|
- commands=None):
|
|
|
+ commands=None, license_file=None):
|
|
|
self.appname = appname
|
|
|
self.version = version
|
|
|
self.publisher = publisher
|
|
@@ -108,6 +108,7 @@ class InstallerBuilder(object):
|
|
|
self.pypi_wheel_reqs = pypi_wheel_reqs or []
|
|
|
self.extra_wheel_sources = extra_wheel_sources or []
|
|
|
self.commands = commands or {}
|
|
|
+ self.license_file = license_file
|
|
|
|
|
|
# Python options
|
|
|
self.py_version = py_version
|
|
@@ -282,7 +283,7 @@ if __name__ == '__main__':
|
|
|
copy to the build directory. Prepare target and parameters for these
|
|
|
shortcuts.
|
|
|
|
|
|
- Also copies shortcut icons
|
|
|
+ Also copies shortcut icons.
|
|
|
"""
|
|
|
files = set()
|
|
|
for scname, sc in self.shortcuts.items():
|
|
@@ -314,9 +315,19 @@ if __name__ == '__main__':
|
|
|
shutil.copy2(sc['icon'], self.build_dir)
|
|
|
sc['icon'] = os.path.basename(sc['icon'])
|
|
|
files.add(sc['icon'])
|
|
|
-
|
|
|
self.install_files.extend([(f, '$INSTDIR') for f in files])
|
|
|
|
|
|
+ def copy_license(self):
|
|
|
+ """
|
|
|
+ If a license file has been specified, ensure it's copied into the
|
|
|
+ install directory and added to the install_files list.
|
|
|
+ """
|
|
|
+ if self.license_file:
|
|
|
+ shutil.copy2(self.license_file, self.build_dir)
|
|
|
+ license_file_name = os.path.basename(self.license_file)
|
|
|
+ self.install_files.append((license_file_name, '$INSTDIR'))
|
|
|
+
|
|
|
+
|
|
|
def prepare_packages(self):
|
|
|
"""Move requested packages into the build directory.
|
|
|
|
|
@@ -448,6 +459,8 @@ if __name__ == '__main__':
|
|
|
|
|
|
self.prepare_shortcuts()
|
|
|
|
|
|
+ self.copy_license()
|
|
|
+
|
|
|
if self.commands:
|
|
|
self.prepare_commands()
|
|
|
|