From a081bc259268acf443139dde9a44c2b5f0a735e4 Mon Sep 17 00:00:00 2001 From: RoDuth Date: Fri, 13 Oct 2017 23:11:23 +1000 Subject: [PATCH 1/7] pep8 etc. --- bauble/utils/web.py | 11 ++++++----- scripts/bump_version.py | 3 ++- setup.py | 20 +++++++++++--------- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/bauble/utils/web.py b/bauble/utils/web.py index b35f6ad1d..dee15791e 100644 --- a/bauble/utils/web.py +++ b/bauble/utils/web.py @@ -31,14 +31,15 @@ from bauble.i18n import _ -def _open_link(func, data=None): +def _open_link(data=None): + """Open a web link""" # windows generates odd characters in the uri unless its in ascii import sys - if sys.platform == 'win32' : - udata=data.decode("utf-8") - asciidata=udata.encode("ascii","ignore") + if sys.platform == 'win32': + udata = data.decode("utf-8") + asciidata = udata.encode("ascii", "ignore") desktop.open(asciidata) - else : desktop.open(data) + else: desktop.open(data) gtk.link_button_set_uri_hook(_open_link) diff --git a/scripts/bump_version.py b/scripts/bump_version.py index e29acaf22..0b8405933 100755 --- a/scripts/bump_version.py +++ b/scripts/bump_version.py @@ -137,7 +137,8 @@ def bump_nsi_file(filename, varname='version'): bump_py_file(os.path.join(root_of_clone(), 'doc/conf.py'), 'release') bump_desktop_file(os.path.join(root_of_clone(), 'data/ghini.desktop')) bump_nsi_file(os.path.join(root_of_clone(), 'scripts/build.nsi')) -bump_nsi_file(os.path.join(root_of_clone(), 'scripts/build-multiuser.nsi'), 'VERSION') +bump_nsi_file(os.path.join(root_of_clone(), 'scripts/build-multiuser.nsi'), + 'VERSION') rx = "(^VERSION=\").*?\..*?\..*?(\".*?%s.*?$)" % bump_tag bump_file(os.path.join(root_of_clone(), 'packages/builddeb.sh'), rx) diff --git a/setup.py b/setup.py index 2f22c1dcb..2d60fe14e 100755 --- a/setup.py +++ b/setup.py @@ -58,11 +58,12 @@ exclude=['test', 'bauble.*.test', 'ghini.*.test']) plugins_pkgs = ['bauble.plugins.%s' % p for p in plugins] all_packages = setuptools.find_packages(exclude=['test', 'bauble.*.test', - 'ghini.*.test']) + 'ghini.*.test']) package_data = {'': ['README.rst', 'CHANGES', 'LICENSE'], - 'bauble': ['*.ui', '*.glade', 'images/*.png', 'pixmaps/*.png', - 'images/*.svg', 'images/*.gif', 'images/*.ico', 'images/*.bmp']} + 'bauble': ['*.ui', '*.glade', 'images/*.png', 'pixmaps/*.png', + 'images/*.svg', 'images/*.gif', 'images/*.ico', + 'images/*.bmp']} # ceate a list of the data patterns to look for in the packages data_patterns = ['default/*.txt', '*.ui', '*.glade', '*.xsl', '*.xsd', @@ -85,8 +86,9 @@ sqlalchemy_includes = ['sqlalchemy.dialects.sqlite', 'sqlalchemy.dialects.postgresql'] py2exe_includes = ['sqlite3', 'lxml', 'gdata', 'fibra', 'psycopg2', - 'encodings', 'mako', 'mako.cache', 'pygments.styles.default', - 'pyparsing'] + gtk_pkgs + plugins_pkgs + sqlalchemy_includes + 'encodings', 'mako', 'mako.cache', + 'pygments.styles.default', 'pyparsing'] + gtk_pkgs \ + + plugins_pkgs + sqlalchemy_includes py2exe_setup_args = { 'windows': [{'script': 'scripts/ghini', 'icon_resources': [(1, "bauble/images/icon.ico")]}]} @@ -105,7 +107,7 @@ "libgtk-win32-2.0-0.dll", "libpango-1.0-0.dll", "libpangowin32-1.0-0.dll", "libxml2-2.dll", # windows dlls - "DNSAPI.DLL","MSIMG32.DLL", "Secur32.dll", "SHFOLDER.dll", + "DNSAPI.DLL", "MSIMG32.DLL", "Secur32.dll", "SHFOLDER.dll", "CRYPT32.dll", "MPR.dll" ] } @@ -176,8 +178,8 @@ def run(self): file_util.copy_file(gtheme, dest) # copy LICENSE to dist\share\LICENSE.ghini (for help>about) - file_util.copy_file("LICENSE", - os.path.join(self.dist_dir, 'share', 'LICENSE.ghini')) + file_util.copy_file("LICENSE", os.path.join(self.dist_dir, 'share', + 'LICENSE.ghini')) class nsis_cmd(Command): # 1. copy the gtk dist to the dist directory @@ -423,7 +425,7 @@ def run(self): scripts = ["scripts/ghini"] if sys.platform == 'win32': scripts = ["scripts/ghini", "scripts/ghini.bat", "scripts/ghini.vbs", - "scripts/ghini-update.bat"] + "scripts/ghini-update.bat"] # TODO: images in bauble/images should really be in data and copied as # package_data or data_files From fe2c16e8870c71594622f704d5c828e3084f59a3 Mon Sep 17 00:00:00 2001 From: RoDuth Date: Fri, 13 Oct 2017 23:22:33 +1000 Subject: [PATCH 2/7] change to non-capitalised name --- scripts/{Add_to_PATH.vbs => add_to_path.vbs} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename scripts/{Add_to_PATH.vbs => add_to_path.vbs} (100%) diff --git a/scripts/Add_to_PATH.vbs b/scripts/add_to_path.vbs similarity index 100% rename from scripts/Add_to_PATH.vbs rename to scripts/add_to_path.vbs From ad1798587f6f264cd0d3e23b4c7b5d894ccb0a15 Mon Sep 17 00:00:00 2001 From: RoDuth Date: Fri, 13 Oct 2017 23:33:18 +1000 Subject: [PATCH 3/7] changing add_to_path filename in nsi --- scripts/build-multiuser.nsi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/build-multiuser.nsi b/scripts/build-multiuser.nsi index 44b8079e6..6eaba24ce 100755 --- a/scripts/build-multiuser.nsi +++ b/scripts/build-multiuser.nsi @@ -479,8 +479,8 @@ Function AddFOPtoPATH ; copy the script to a temp dir SetOutPath "$PLUGINSDIR\" SetOverwrite on - File /a "Add_to_PATH.vbs" - ExecWait '"$SYSDIR\wscript.exe" //E:vbscript "$PLUGINSDIR\Add_to_PATH.vbs" /path:"$R0\fop-${FOP_VERSION}\" /env:"$R1"' + File /a "add_to_path.vbs" + ExecWait '"$SYSDIR\wscript.exe" //E:vbscript "$PLUGINSDIR\add_to_path.vbs" /path:"$R0\fop-${FOP_VERSION}\" /env:"$R1"' DetailPrint "Apache FOP added to $R1 PATH as: $R0\fop-${FOP_VERSION}\" SetRebootFlag True DetailPrint "Reboot flag = True" From 79b00fb0ea8e913f1a71e6d840aa1f6f487e8abf Mon Sep 17 00:00:00 2001 From: RoDuth Date: Sat, 14 Oct 2017 10:29:30 +1000 Subject: [PATCH 4/7] changing variables to all capitals --- scripts/build-multiuser.nsi | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/build-multiuser.nsi b/scripts/build-multiuser.nsi index 6eaba24ce..c7ec9aa25 100755 --- a/scripts/build-multiuser.nsi +++ b/scripts/build-multiuser.nsi @@ -56,14 +56,14 @@ ; Global Name "ghini.desktop" !define VERSION "1.0.68" ; :bump -!define src_dir "..\dist" +!define SRC_DIR "..\dist" !define PRODUCT_NAME "ghini.desktop" Outfile "${PRODUCT_NAME}-${VERSION}-setup.exe" !define PROGEXE "ghini.exe" !define COMPANY_NAME "" -!define license_file "LICENSE" -!define readme "README.rst" -!define startmenu "$SMPROGRAMS\${PRODUCT_NAME}" +!define LICENSE_FILE "LICENSE" +!define README "README.rst" +!define START_MENU "$SMPROGRAMS\${PRODUCT_NAME}" !define UNINSTALL_FILENAME "uninstall.exe" ; FOP @@ -113,11 +113,11 @@ CRCCheck on ; Modern User Interface v2 Settings !define MUI_ABORTWARNING !define MUI_UNABORTWARNING -!define MUI_ICON "${src_dir}\bauble\images\icon.ico" -!define MUI_UNICON "${src_dir}\bauble\images\icon.ico" +!define MUI_ICON "${SRC_DIR}\bauble\images\icon.ico" +!define MUI_UNICON "${SRC_DIR}\bauble\images\icon.ico" !define MUI_HEADERIMAGE -!define MUI_HEADERIMAGE_BITMAP "${src_dir}\bauble\images\ghini_logo.bmp" -!define MUI_HEADERIMAGE_UNBITMAP "${src_dir}\bauble\images\ghini_logo.bmp" +!define MUI_HEADERIMAGE_BITMAP "${SRC_DIR}\bauble\images\ghini_logo.bmp" +!define MUI_HEADERIMAGE_UNBITMAP "${SRC_DIR}\bauble\images\ghini_logo.bmp" !define MUI_HEADERIMAGE_RIGHT !define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_COMPONENTSPAGE_TEXT_COMPLIST "Or, select the optional components you wish to install: \ @@ -149,7 +149,7 @@ CRCCheck on ; PAGES ; Installer -!insertmacro MUI_PAGE_LICENSE "${src_dir}\${license_file}" +!insertmacro MUI_PAGE_LICENSE "${SRC_DIR}\${LICENSE_FILE}" !insertmacro MULTIUSER_PAGE_INSTALLMODE ; this will show the 2 install options, unless it's an elevated inner process ; (in that case we know we should install for all users) @@ -196,7 +196,7 @@ Section "!Ghini.desktop" SecMain SetOverwrite on ; package all files, recursively, preserving attributes ; assume files are in the correct places - File /a /r "${src_dir}\*.*" + File /a /r "${SRC_DIR}\*.*" ; Create uninstaller WriteUninstaller "$INSTDIR\${UNINSTALL_FILENAME}" @@ -204,8 +204,8 @@ Section "!Ghini.desktop" SecMain ; add registry keys !insertmacro MULTIUSER_RegistryAddInstallInfo ; create shortcuts - CreateDirectory "${startmenu}" - CreateShortcut "${startmenu}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PROGEXE}" \ + CreateDirectory "${START_MENU}" + CreateShortcut "${START_MENU}\${PRODUCT_NAME}.lnk" "$INSTDIR\${PROGEXE}" \ "" "$INSTDIR\${PROGEXE}" "" SW_SHOWNORMAL \ "" "Ghini biodiversity collection manager" ; desktop shortcut @@ -415,11 +415,11 @@ UninstallText "This will uninstall ${PRODUCT_NAME}." Section "Uninstall" SecUnMain ; Remove registry keys !insertmacro MULTIUSER_RegistryRemoveInstallInfo - Delete "${startmenu}\*.*" + Delete "${START_MENU}\*.*" Delete "$DESKTOP\${PRODUCT_NAME}.lnk" SetOutPath $TEMP RMDir /r "$INSTDIR" - RMDir /r "${startmenu}" + RMDir /r "${START_MENU}" SectionEnd From ddf12b8da105547a5a3b5f2cc1a516c2438d4c4d Mon Sep 17 00:00:00 2001 From: RoDuth Date: Sat, 14 Oct 2017 12:34:51 +1000 Subject: [PATCH 5/7] else: to 2 lines --- bauble/utils/web.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bauble/utils/web.py b/bauble/utils/web.py index dee15791e..e51af7d99 100644 --- a/bauble/utils/web.py +++ b/bauble/utils/web.py @@ -39,7 +39,8 @@ def _open_link(data=None): udata = data.decode("utf-8") asciidata = udata.encode("ascii", "ignore") desktop.open(asciidata) - else: desktop.open(data) + else: + desktop.open(data) gtk.link_button_set_uri_hook(_open_link) From 745e2da1123660a0a41f5b47df9f9b6cdee61d14 Mon Sep 17 00:00:00 2001 From: RoDuth Date: Sat, 14 Oct 2017 15:08:26 +1000 Subject: [PATCH 6/7] split py2exe_includes over 2 lines --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2d60fe14e..81914ad93 100755 --- a/setup.py +++ b/setup.py @@ -87,8 +87,8 @@ 'sqlalchemy.dialects.postgresql'] py2exe_includes = ['sqlite3', 'lxml', 'gdata', 'fibra', 'psycopg2', 'encodings', 'mako', 'mako.cache', - 'pygments.styles.default', 'pyparsing'] + gtk_pkgs \ - + plugins_pkgs + sqlalchemy_includes + 'pygments.styles.default', 'pyparsing'] + py2exe_includes += gtk_pkgs + plugins_pkgs + sqlalchemy_includes py2exe_setup_args = { 'windows': [{'script': 'scripts/ghini', 'icon_resources': [(1, "bauble/images/icon.ico")]}]} From 2b530445d3be68ef4661f107d12af10ca9dbcc8a Mon Sep 17 00:00:00 2001 From: RoDuth Date: Sun, 15 Oct 2017 08:05:04 +1000 Subject: [PATCH 7/7] remove TODO --- scripts/build-multiuser.nsi | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scripts/build-multiuser.nsi b/scripts/build-multiuser.nsi index 221a18126..3a74b16dc 100755 --- a/scripts/build-multiuser.nsi +++ b/scripts/build-multiuser.nsi @@ -169,7 +169,6 @@ CRCCheck on ; LANGUAGES ; MUIv2 macros (must be after scripts and pages) -; TODO add more languages? !insertmacro MUI_LANGUAGE English @@ -375,7 +374,7 @@ Section /o "MS Visual C runtime DLL (1.73MB Download)" SecMSC Goto DoneMSVC ; Install MS Visual C Runtime - ; TODO there seems to be a bug in the installer that leaves junk files in the root directory of the largest drive + ; there seems to be a bug in the installer that leaves junk files in the root directory of the largest drive. InstalMSVC: ; run installer silently (no user input, no cancel button) ExecWait '"$PLUGINSDIR\${MSVC_FILE}" /qb!' @@ -405,7 +404,6 @@ SectionGroupEnd ; UNINSTALLER SECTIONS ; ; All section names prefixed by "Un" will be in the uninstaller -; TODO include a FOP uninstaller ; Settings UninstallText "This will uninstall ${PRODUCT_NAME}."