forked from ngld/old-knossos
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
130 lines (106 loc) · 4.34 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
#!/usr/bin/python
## Copyright 2015 Knossos authors, see NOTICE file
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
import sys
from setuptools import setup
from codecs import open # To use a consistent encoding
from os import path
import re
here = path.abspath(path.dirname(__file__))
# Get the long description from the relevant file
with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:
long_description = f.read()
# Grab the current version
with open(path.join(here, 'knossos', 'center.py'), 'r', encoding='utf-8') as f:
m = re.search(r"VERSION = '([^']+)'", f.read())
if m:
version = m.group(1)
else:
version = 'XXX'
if '-dev' in version:
if not path.exists(path.join(here, '.git')):
sys.stderr.write('WARNING: No .git directory found while building a devbuild!\n')
else:
with open(path.join(here, '.git/HEAD')) as stream:
ref = stream.read().strip().split(':')
if ref[0] == 'ref':
info_file = path.join(here, '.git/logs/' + ref[1].strip())
if path.isfile(info_file):
with open(info_file) as stream:
data = stream.read()
commit = data[:7]
if commit == '0000000':
commit = data.splitlines()[-1].split(' ')[1][:7]
version += '+' + commit
elif len(ref[0]) == 40:
version += '+' + ref[0][:7]
else:
sys.stderr.write('WARNING: Parsing .git/HEAD failed!')
if len(sys.argv) == 2 and sys.argv[1] == 'get_version':
print(version)
sys.exit(0)
pkg_data = {
'knossos': ['data/*']
}
# Bundle the html files only for the dev versions
if '-dev' in version:
pkg_data['knossos'].extend(['../html/*.html', '../html/css/*', '../html/fonts/*', '../html/js/*'])
setup(
name='knossos',
# This version should comply with PEP440 (http://legacy.python.org/dev/peps/pep-0440/).
# The first three numbers should be the same as VERSION in knossos/center.py.
version=version,
description='A simple mod manager for FreeSpace 2 Open',
long_description=long_description,
# The project's main homepage.
url='https://github.com/ngld/knossos',
# Author details
author='ngld',
author_email='[email protected]',
# See https://pypi.python.org/pypi?%3Aaction=list_classifiers
classifiers=[
# How mature is this project? Common values are
# 3 - Alpha
# 4 - Beta
# 5 - Production/Stable
'Development Status :: 3 - Alpha',
'Intended Audience :: End Users/Desktop',
'License :: OSI Approved :: Apache Software License',
# Supported Python versions
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6'
],
keywords='fso freespace',
packages=['knossos', 'knossos.ui', 'knossos.third_party'],
install_requires=['six', 'requests', 'requests_toolbelt', 'ply', 'semantic_version', 'raven', 'PyQt5', 'token_bucket'],
# List additional groups of dependencies here (e.g. development dependencies).
# You can install these using the following syntax, for example:
# $ pip install -e .[dev,test]
extras_require={
},
package_data=pkg_data,
data_files=[],
# To provide executable scripts, use entry points in preference to the
# "scripts" keyword. Entry points provide cross-platform support and allow
# pip to create the appropriate form of executable for the target platform.
entry_points={
'gui_scripts': [
'knossos=knossos.launcher:main',
]
}
)