From 2977f1a6b9e69b0218ea37fba6a43766556c55e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mike=20F=C3=A4hrmann?= Date: Wed, 29 Sep 2021 18:41:11 +0200 Subject: [PATCH] re-enable py2exe in setup.py had to patch the native 'certifi' hook to def hook_certifi(finder, module): import certifi finder.add_datafile_to_zip("certifi/cacert.pem", certifi.where()) to make everything work --- setup.py | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index ab708d86..1a5c315f 100644 --- a/setup.py +++ b/setup.py @@ -40,13 +40,51 @@ FILES = [ ] ] +DESCRIPTION = ("Command-line program to download image galleries and " + "collections from several image hosting sites") +LONG_DESCRIPTION = read("README.rst") + + +if "py2exe" in sys.argv: + try: + import py2exe + except ImportError: + sys.exit("Error importing 'py2exe'") + + # py2exe dislikes version specifiers with a trailing '-dev' + VERSION = VERSION.partition("-")[0] + + params = { + "console": [{ + "script" : "./gallery_dl/__main__.py", + "dest_base" : "gallery-dl", + "version" : VERSION, + "description" : DESCRIPTION, + "comments" : LONG_DESCRIPTION, + "product_name" : "gallery-dl", + "product_version": VERSION, + }], + "options": {"py2exe": { + "bundle_files": 0, + "compressed" : 1, + "optimize" : 1, + "dist_dir" : ".", + "packages" : ["gallery_dl"], + "includes" : ["youtube_dl"], + "dll_excludes": ["w9xpopen.exe"], + }}, + "zipfile": None, + } + +else: + params = {} + setup( name="gallery_dl", version=VERSION, - description=("Command-line program to download image galleries and " - "collections from several image hosting sites"), - long_description=read("README.rst"), + description=DESCRIPTION, + long_description=LONG_DESCRIPTION, url="https://github.com/mikf/gallery-dl", download_url="https://github.com/mikf/gallery-dl/releases/latest", author="Mike Fährmann", @@ -96,4 +134,5 @@ setup( "Topic :: Utilities", ], test_suite="test", + **params, )