forked from joejaywww/cinemagoer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
163 lines (137 loc) · 4.68 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
import glob
import sys
from subprocess import CalledProcessError, check_call
import setuptools
# version of the software from imdb/version.py
exec(compile(open('imdb/version.py').read(), 'imdb/version.py', 'exec'))
home_page = 'https://cinemagoer.github.io/'
long_desc = """Cinemagoer is a Python package useful to retrieve and
manage the data of the IMDb movie database about movies, people,
characters and companies.
Cinemagoer and its authors are not affiliated in any way to
Internet Movie Database Inc.; see the DISCLAIMER.txt file for
details about data licenses.
Platform-independent and written in Python 3
Cinemagoer package can be very easily used by programmers and developers
to provide access to the IMDb's data to their programs.
Some simple example scripts - useful for the end users - are included
in this package; other Cinemagoer-based programs are available at the
home page: %s
""" % home_page
dwnl_url = 'https://cinemagoer.github.io/downloads/'
classifiers = """\
Development Status :: 5 - Production/Stable
Environment :: Console
Environment :: Web Environment
Intended Audience :: Developers
Intended Audience :: End Users/Desktop
License :: OSI Approved :: GNU General Public License (GPL)
Natural Language :: English
Natural Language :: Italian
Natural Language :: Turkish
Programming Language :: Python
Programming Language :: Python :: 3.11
Programming Language :: Python :: 3.10
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3.6
Programming Language :: Python :: 3.5
Programming Language :: Python :: 2.7
Programming Language :: Python :: Implementation :: CPython
Programming Language :: Python :: Implementation :: PyPy
Operating System :: OS Independent
Topic :: Database :: Front-Ends
Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI Tools/Libraries
Topic :: Software Development :: Libraries :: Python Modules
"""
keywords = ['imdb', 'movie', 'people', 'database', 'cinema', 'film', 'person',
'cast', 'actor', 'actress', 'director', 'sql', 'character',
'company', 'package', 'plain text data files',
'keywords', 'top250', 'bottom100', 'xml']
scripts = glob.glob('./bin/*.py')
params = {
# Meta-information.
'name': 'cinemagoer',
'version': __version__,
'description': 'Python package to access the IMDb\'s database',
'long_description': long_desc,
'author': 'Davide Alberani',
'author_email': 'da@mimante.net',
'maintainer': 'Davide Alberani',
'maintainer_email': 'da@mimante.net',
'license': 'GPL',
'platforms': 'any',
'keywords': keywords,
'classifiers': [_f for _f in classifiers.split("\n") if _f],
'url': home_page,
'project_urls': {
'Source': 'https://github.com/cinemagoer/cinemagoer',
},
'download_url': dwnl_url,
'scripts': scripts,
'package_data': {
# Here, the "*" represents any possible language ID.
'imdb.locale': [
'imdbpy.pot',
'imdbpy-*.po',
'*/LC_MESSAGES/imdbpy.mo',
],
},
'install_requires': ['SQLAlchemy', 'lxml'],
'extras_require': {
'dev': [
'flake8',
'flake8-isort',
'pytest',
'pytest-cov',
'tox',
],
'doc': [
'sphinx',
'sphinx_rtd_theme'
]
},
'packages': setuptools.find_packages(),
'entry_points': """
[console_scripts]
imdbpy=imdb.cli:main
"""
}
ERR_MSG = """
====================================================================
ERROR
=====
Aaargh! An error! An error!
Curse my metal body, I wasn't fast enough. It's all my fault!
Anyway, if you were trying to build a package or install Cinemagoer to your
system, looks like we're unable to fetch or install some dependencies.
The best solution is to resolve these dependencies (maybe you're
not connected to Internet?)
The caught exception, is re-raise below:
"""
def runRebuildmo():
"""Call the function to rebuild the locales."""
try:
check_call([sys.executable, "rebuildmo.py"])
except CalledProcessError as e:
print('ERROR: unable to rebuild .mo files; caught exception %s' % e)
def hasCommand():
"""Return true if at least one command is found on the command line."""
args = sys.argv[1:]
if '--help' in args:
return False
if '-h' in args:
return False
if 'clean' in args:
return False
for arg in args:
if arg and not arg.startswith('-'):
return True
return False
try:
if hasCommand():
runRebuildmo()
except SystemExit:
print(ERR_MSG)
setuptools.setup(**params)