Ver Fonte

Add Application/publisher configuration option

Brecht Machiels há 8 anos atrás
pai
commit
b1200e2b47
4 ficheiros alterados com 15 adições e 4 exclusões
  1. 4 0
      doc/cfgfile.rst
  2. 6 4
      nsist/__init__.py
  3. 1 0
      nsist/configreader.py
  4. 4 0
      nsist/pyapp.nsi

+ 4 - 0
doc/cfgfile.rst

@@ -17,6 +17,10 @@ Application section
 
   The version number of your application.
 
+.. describe:: publisher (optional)
+
+  The publisher name that shows up in the *Add or Remove programs* control panel.
+
 .. describe:: entry_point
 
    The function to launch your application, in the format ``module:function``.

+ 6 - 4
nsist/__init__.py

@@ -91,14 +91,15 @@ class InstallerBuilder(object):
     :param str installer_name: Filename of the installer to produce
     :param str nsi_template: Path to a template NSI file to use
     """
-    def __init__(self, appname, version, shortcuts, icon=DEFAULT_ICON,
-                packages=None, extra_files=None, py_version=DEFAULT_PY_VERSION,
-                py_bitness=DEFAULT_BITNESS, py_format=None,
-                inc_msvcrt=True, build_dir=DEFAULT_BUILD_DIR,
+    def __init__(self, appname, version, shortcuts, publisher=None,
+                icon=DEFAULT_ICON, packages=None, extra_files=None,
+                py_version=DEFAULT_PY_VERSION, py_bitness=DEFAULT_BITNESS,
+                py_format=None, inc_msvcrt=True, build_dir=DEFAULT_BUILD_DIR,
                 installer_name=None, nsi_template=None,
                 exclude=None, pypi_wheel_reqs=None, commands=None):
         self.appname = appname
         self.version = version
+        self.publisher = publisher
         self.shortcuts = shortcuts
         self.icon = icon
         self.packages = packages or []
@@ -535,6 +536,7 @@ def main(argv=None):
         InstallerBuilder(
             appname = appcfg['name'],
             version = appcfg['version'],
+            publisher = appcfg.get('publisher', None),
             icon = appcfg.get('icon', DEFAULT_ICON),
             shortcuts = shortcuts,
             commands=commands,

+ 1 - 0
nsist/configreader.py

@@ -54,6 +54,7 @@ CONFIG_VALIDATORS = {
     'Application': SectionValidator([
         ('name', True),
         ('version', True),
+        ('publisher', False),
         ('entry_point', False),
         ('script', False),
         ('target', False),

+ 4 - 0
nsist/pyapp.nsi

@@ -103,6 +103,10 @@ Section "!${PRODUCT_NAME}" sec_app
                    "InstallLocation" "$INSTDIR"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
                    "DisplayIcon" "$INSTDIR\${PRODUCT_ICON}"
+  [% if ib.publisher is not none %]
+    WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
+                     "Publisher" "[[ib.publisher]]"
+  [% endif %]
   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \
                    "NoModify" 1
   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" \