update setup.py to enable py2exe

pull/13/head
Mike Fährmann 8 years ago
parent 501b64fa9d
commit 293c85f4a0
No known key found for this signature in database
GPG Key ID: 5680CA389D365A88

@ -1,24 +1,74 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys
import os.path import os.path
try: try:
from setuptools import setup from setuptools import setup
has_setuptools = True
except ImportError: except ImportError:
from distutils.core import setup from distutils.core import setup
has_setuptools = False
def read(fname): def read(fname):
return open(os.path.join(os.path.dirname(__file__), fname)).read() return open(os.path.join(os.path.dirname(__file__), fname)).read()
# get version without importing the package # get version without importing the package
exec(read("gallery_dl/version.py")) exec(read("gallery_dl/version.py"))
DESCRIPTION = ("Command-line program to download image galleries and "
"collections from pixiv, exhentai, danbooru, gelbooru, nijie "
"and more")
LONG_DESCRIPTION = read("README.rst")
if "py2exe" in sys.argv:
try:
import py2exe
except ImportError:
print("Error importing 'py2exe'", file=sys.stderr)
sys.exit(1)
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": 1,
"compressed": 1,
"optimize": 2,
"dist_dir": ".",
"packages": ["gallery_dl"],
"dll_excludes": ["w9xpopen.exe", "crypt32.dll"],
}},
"zipfile": None
}
elif has_setuptools:
params = {
"entry_points": {
"console_scripts": [
"gallery-dl = gallery_dl:main"
]
}
}
else:
params = {
"scripts": ["bin/gallery-dl"]
}
setup( setup(
name="gallery_dl", name="gallery_dl",
version=__version__, version=__version__,
description="Command-line program to download image galleries and collections from pixiv, exhentai, danbooru, gelbooru, nijie and more", description=DESCRIPTION,
long_description=read("README.rst"), long_description=LONG_DESCRIPTION,
url="https://github.com/mikf/gallery-dl", url="https://github.com/mikf/gallery-dl",
download_url="https://github.com/mikf/gallery-dl/releases/latest", download_url="https://github.com/mikf/gallery-dl/releases/latest",
author="Mike Fährmann", author="Mike Fährmann",
@ -30,14 +80,6 @@ setup(
install_requires=[ install_requires=[
"requests >= 2.4.2", "requests >= 2.4.2",
], ],
scripts=[
"bin/gallery-dl",
],
entry_points={
'console_scripts': [
'gallery-dl = gallery_dl:main',
],
},
packages=[ packages=[
"gallery_dl", "gallery_dl",
"gallery_dl.extractor", "gallery_dl.extractor",
@ -61,5 +103,6 @@ setup(
"Topic :: Multimedia", "Topic :: Multimedia",
"Topic :: Multimedia :: Graphics", "Topic :: Multimedia :: Graphics",
], ],
test_suite='test', test_suite="test",
**params
) )

Loading…
Cancel
Save