forked from zanata/zanata-python-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·67 lines (58 loc) · 1.78 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
#!/usr/bin/env python
"""
Build script for zanata-python-client
"""
from setuptools import setup, find_packages
import os
import subprocess
def get_client_version():
number = ""
path = os.path.dirname(os.path.realpath(__file__))
version_file = os.path.join(path, 'zanataclient/VERSION-FILE')
version_gen = os.path.join(path, 'VERSION-GEN')
p = subprocess.Popen(version_gen, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, close_fds=True)
output = p.stdout.readline()
number = output.rstrip().strip('version: ')
subprocess.Popen("""
cat << EOF > MANIFEST.in
include zanataclient/VERSION-FILE
EOF
""", shell=True)
if number=='UKNOWN':
try:
file = open(version_file, 'rb')
client_version = file.read()
file.close()
number = client_version[:-1].strip('version: ')
except IOError:
file = open(version_file, 'w')
file.write("version: UKNOWN")
file.close
return number
setup (name = "zanata-python-client",
version = get_client_version(),
packages = find_packages(),
include_package_data = True,
install_requires=[
'polib' ,
'httplib2'
],
description = "Zanata Python Client.",
author = 'Jian Ni',
author_email = '[email protected]',
license = 'LGPLv2+',
platforms=["Linux"],
scripts = ["zanata","flies"],
#entry_points = {
#'console_scripts': [
# 'zanata = zanataclient.zanata:main',
#]
#},
package_data = {
'': ['VERSION-FILE']
},
classifiers=['License :: OSI Approved :: GNU Lesser General Public License (LGPL)',
'Operating System :: Unix',
'Programming Language :: Python',
],
)