forked from niess/python-appimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
100 lines (83 loc) · 2.89 KB
/
setup.py
File metadata and controls
100 lines (83 loc) · 2.89 KB
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
import json
import os
import setuptools
import ssl
import subprocess
from python_appimage.utils.deps import ensure_excludelist
from python_appimage.utils.url import urlopen
CLASSIFIERS = '''\
Development Status :: 4 - Beta
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License v3 (GPLv3)
Programming Language :: Python
Topic :: Software Development
Operating System :: POSIX :: Linux
'''
with open('README.md') as f:
long_description = f.read()
def get_version():
'''Get the next version number from PyPI
'''
version = os.getenv('PYTHON_APPIMAGE_VERSION')
if not version:
try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context
meta = json.load(
urlopen('https://pypi.org/pypi/python-appimage/json'))
version = meta['info']['version']
numbers = version.split('.')
numbers[-1] = str(int(numbers[-1]) + 1)
version = '.'.join(numbers)
p = subprocess.Popen('git describe --match=NeVeRmAtCh --always --dirty',
shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
stdout, _ = p.communicate()
try:
stdout = stdout.decode()
except AttributeError:
stdout = str(stdout)
git_revision = stdout.strip()
with open('python_appimage/version.py', 'w+') as f:
f.write('''\
# This file was generated by setup.py
version = '{version:}'
git_revision = '{git_revision:}'
'''.format(version=version, git_revision=git_revision))
return version
def get_package_data():
'''Get the list of package data
'''
ensure_excludelist()
prefix = os.path.dirname(__file__) or '.'
return ['data/' + file_
for file_ in os.listdir(prefix + '/python_appimage/data')]
setuptools.setup(
name = 'python_appimage',
version = get_version(),
author = 'Valentin Niess',
description = 'Appimage releases of Python',
long_description = long_description,
long_description_content_type = 'text/markdown',
url = 'https://github.com/niess/python-appimage',
download_url = 'https://pypi.python.org/pypi/python-appimage',
project_urls = {
'Bug Tracker' : 'https://github.com/niess/python-appimage/issues',
'Source Code' : 'https://github.com/niess/python-appimage',
},
packages = setuptools.find_packages(),
classifiers = [s for s in CLASSIFIERS.split(os.linesep) if s.strip()],
license = 'GPLv3',
platforms = ['Linux'],
python_requires = '>=2.7',
include_package_data = True,
package_data = {'': get_package_data()},
entry_points = {
'console_scripts' : (
'python-appimage = python_appimage.__main__:main',)
}
)