update py2exe & build using its new 'freeze()' API

pull/3119/head
Mike Fährmann 2 years ago
parent 2bdcd85ced
commit 6df03fe564
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -5,7 +5,6 @@ import re
import sys
import os.path
import warnings
from setuptools import setup
def read(fname):
@ -41,47 +40,53 @@ FILES = [
]
]
PACKAGES = [
"gallery_dl",
"gallery_dl.extractor",
"gallery_dl.downloader",
"gallery_dl.postprocessor",
]
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'")
def build_py2exe():
from py2exe import freeze
# py2exe dislikes version specifiers with a trailing '-dev'
VERSION = VERSION.partition("-")[0]
VERSION_ = VERSION.partition("-")[0]
params = {
"console": [{
freeze(
console=[{
"script" : "./gallery_dl/__main__.py",
"dest_base" : "gallery-dl",
"version" : VERSION,
}],
version_info={
"version" : VERSION_,
"description" : DESCRIPTION,
"comments" : LONG_DESCRIPTION,
"product_name" : "gallery-dl",
"product_version": VERSION,
}],
"options": {"py2exe": {
"bundle_files": 0,
"product_version": VERSION_,
},
options={
"bundle_files" : 0,
"compressed" : 1,
"optimize" : 1,
"dist_dir" : ".",
"packages" : ["gallery_dl"],
"dist_dir" : "./dist",
"packages" : PACKAGES,
"includes" : ["youtube_dl"],
"dll_excludes": ["w9xpopen.exe"],
}},
"zipfile": None,
}
"dll_excludes" : ["w9xpopen.exe"],
},
zipfile=None,
)
else:
params = {}
def build_setuptools():
from setuptools import setup
setup(
setup(
name="gallery_dl",
version=VERSION,
description=DESCRIPTION,
@ -102,18 +107,14 @@ setup(
"youtube-dl",
],
},
packages=[
"gallery_dl",
"gallery_dl.extractor",
"gallery_dl.downloader",
"gallery_dl.postprocessor",
],
entry_points={
"console_scripts": [
"gallery-dl = gallery_dl:main",
],
},
packages=PACKAGES,
data_files=FILES,
test_suite="test",
keywords="image gallery downloader crawler scraper",
classifiers=[
"Development Status :: 5 - Production/Stable",
@ -134,6 +135,10 @@ setup(
"Topic :: Multimedia :: Graphics",
"Topic :: Utilities",
],
test_suite="test",
**params,
)
)
if "py2exe" in sys.argv:
build_py2exe()
else:
build_setuptools()

Loading…
Cancel
Save