This repository has been archived by the owner on Sep 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
92 lines (80 loc) · 2.84 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
import sys
import requests
import setuptools
# cx_freeze interferes with 'normal' setup, so only load it when the relevant
# cx_freeze functions are run
if sys.argv[1] in ("bdist_msi", "bdist_mac", "bdist_dmg", "build_exe"):
freezing = True
from cx_Freeze import setup, Executable
else:
freezing = False
from setuptools import setup
# load some metadata from other files
with open("README.md", "r") as fh:
long_description = fh.read()
with open("dmi_instascraper/VERSION", "r") as fh:
version = fh.read()
with open("requirements.txt", "r") as fh:
requirements = [line.strip() for line in fh.readlines()]
app_name = "dmi-instascraper"
# again, some extra cx_freeze stuff
extra_setup = {}
if freezing:
base = None
# GUI applications require a different base on Windows (the default is for a
# console application).
if sys.platform == "win32":
base = "Win32GUI"
exe_name = "dmi-instascraper.exe"
else:
exe_name = "DMInstascraper"
app_name = exe_name
# these excludes don't seem to do much unfortunately...
assets = ["dmi_instascraper/VERSION"]
build_exe_options = {
"optimize": 2,
"include_msvcr": True,
"packages": ["wx", "instaloader", "requests"],
"includes": ["queue", "certifi"],
"excludes": ["matplotlib.tests", "numpy.random._examples", "wx.lib", "jinja2"],
"include_files": [(requests.certs.where(), 'lib/certifi/cacert.pem'), *[(asset, "lib/dmi_instascraper/" + asset) for asset in assets]]
}
# fancy icon and nice exe name
extra_setup = {
"options": {"build_exe": build_exe_options},
"executables": [Executable(
"dmi_instascraper/__main__.py",
base=base,
targetName=exe_name,
icon="icon.ico"
)]
}
if sys.platform == "darwin":
extra_setup["options"]["bdist_mac"] = {
"iconfile": "icon.icns",
"bundle_name": "DMI Instagram Scraper",
}
extra_setup["options"]["bdist_dmg"]: {
"volume_label": "DMI Instagram Scraper",
"applications_shortcut": True
}
setup(
name=app_name,
version=version,
author="Digital Methods Initiative",
author_email="[email protected]",
description="A GUI wrapper around instaloader to scrape Instagram hashtags and users with",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/digitalmethodsinitiative/dmi-instascraper",
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
install_requires=requirements,
**extra_setup
)