-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsetup.py
61 lines (50 loc) · 1.91 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
import subprocess
from setuptools import setup, find_packages
from os import path, environ
_base_version = '0.2.4'
_root_dir = path.abspath(path.dirname(__file__))
def readme():
with open(path.join(_root_dir, 'README.md')) as f:
return f.read()
# See https://packaging.python.org/guides/single-sourcing-package-version/
# This uses method 4 on this list combined with other methods.
def _get_version_number():
travis_build = environ.get('TRAVIS_BUILD_NUMBER')
travis_tag = environ.get('TRAVIS_TAG')
if travis_build:
if travis_tag:
version = travis_tag
else:
version = '{}.dev{}'.format(_base_version, travis_build)
with open(path.join(_root_dir, 'VERSION'), 'w') as version_file:
version_file.write(version.strip())
else:
try:
ver = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
version = '{}+local.{}'.format(_base_version, ver.decode('ascii').strip())
except Exception:
with open(path.join(_root_dir, 'VERSION')) as version_file:
version = version_file.read().strip()
return version
setup(name='mapactionpy_qgis',
version=_get_version_number(),
description='Used to drive QGIS',
long_description=readme(),
long_description_content_type="text/markdown",
url='http://github.com/mapaction/mapactionpy_qgis',
author='MapAction',
author_email='github@mapaction.com',
license='GPL3',
packages=find_packages(),
install_requires=[
'mapactionpy_controller'
],
test_suite='unittest',
tests_require=['unittest'],
zip_safe=False,
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: OS Independent",
])