-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
94 lines (85 loc) · 3.2 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
import os
import sys
from setuptools import setup
from subprocess import check_output
pext_path = os.path.dirname(os.path.abspath(__file__))
pext_version_path = os.path.join(pext_path, 'pext', 'VERSION')
with open(pext_version_path) as version_file:
version = version_file.read().strip()
try:
from dulwich.porcelain import describe
print("Updating version with dulwich")
version = describe(pext_path)
except Exception as e:
print("Failed to determine version with dulwich, falling back to git describe: {}".format(e))
try:
version = check_output(['git', 'describe'], cwd=pext_path).splitlines()[0]
except Exception as e:
print("Failed to determine version with git describe: {}".format(e))
if isinstance(version, bytes):
version = version.decode()
version = version.lstrip("v")
version = version.replace('-', '+', 1).replace('-', '.')
with open(pext_version_path, "w") as version_file:
version_file.write(version)
with open(os.path.join(pext_path, 'requirements.txt')) as requirements_file:
requirements = []
for line in requirements_file:
requirement_spec = line.strip().split(';', 1)
if len(requirement_spec) == 1 or eval(requirement_spec[1]):
requirements.append(requirement_spec[0])
if sys.platform == 'linux':
extra_options = dict(
data_files=[
('share/icons/hicolor/scalable/apps', ['pext/images/scalable/pext.svg']),
('share/icons/hicolor/48x48/apps', ['pext/images/48x48/pext.png']),
('share/icons/hicolor/128x128/apps', ['pext/images/128x128/pext.png']),
('share/applications', ['io.pext.pext.desktop']),
('share/metainfo', ['io.pext.pext.appdata.xml'])
]
)
else:
extra_options = dict()
setup(
name='Pext',
version=version,
install_requires=requirements,
description='Python-based extendable tool',
long_description='A Python-based application that uses modules for extendability',
url='https://pext.io/',
author='Sylvia van Os',
author_email='[email protected]',
license='GPLv3+',
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: X11 Applications :: Qt',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
'Operating System :: MacOS',
'Operating System :: POSIX :: Linux',
'Operating System :: Microsoft :: Windows',
'Programming Language :: Python :: 3 :: Only',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Utilities'
],
keywords='extendable pluggable',
packages=[
'pext',
'pext/helpers',
'pext_dev'
],
package_data={'pext': ['VERSION', 'i18n/*.qm', 'images/128x128/*', 'images/scalable/*', 'qml/*', 'helpers/*', '*.py', 'Pext.workflow/*'],
'pext_dev': ['module/*', 'theme/*', '*.py']},
zip_safe=False,
entry_points={
'gui_scripts': [
'pext=pext.__main__:main'
],
'console_scripts': [
'pext_dev=pext_dev.__main__:main'
]
},
**extra_options
)