This repository has been archived by the owner on Oct 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
executable file
·117 lines (106 loc) · 3.64 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
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, re
import glob
from codecs import BOM
from setuptools import setup, find_packages
from setuptools.command.build_py import build_py as _build_py
from transifex.txcommon import version
readme_file = open(u'README.rst')
long_description = readme_file.read()
readme_file.close()
if long_description.startswith(BOM):
long_description = long_description.lstrip(BOM)
long_description = long_description.decode('utf-8')
package_data = {
'': ['LICENCE', 'README.rst'],
'transifex': ['transifex/static/*.*']
}
def get_requirements(filename):
"""
Read requirements and dependency links from a file passed by parameter
and return them as two lists in a tuple.
"""
def add_dependency_link(line):
link = re.sub(r'\s*-[ef]\s+', '', line)
filename = os.path.basename(link.split('://')[1])
url = link.split(filename)[0]
if url not in dependency_links:
dependency_links.append(url)
requirements = []
dependency_links = []
for line in open(filename, 'r').read().split('\n'):
if re.match(r'(\s*#)|(\s*$)', line):
continue
if re.match(r'\s*-e\s+', line):
# TODO support version numbers
requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line))
add_dependency_link(line)
elif re.match(r'\s*-f\s+', line):
add_dependency_link(line)
else:
requirements.append(line)
return requirements, dependency_links
requirements, dependency_links = get_requirements('requirements.txt')
def buildlanguages():
import django.core.management.commands.compilemessages as c
oldpath = os.getcwd()
os.chdir(os.path.join(os.path.dirname(__FILE__), 'transifex',
'locale'))
c.compile_messages()
os.chdir(oldpath)
class build_py(_build_py):
def run(self):
buildlanguages()
_build_py.run(self)
setup(
# cmdclass={
# 'build_py': build_py,
# },
name="transifex",
version=version,
description="The software behind Transifex.net, the open service to collaboratively translate software, documentation and websites.",
long_description=long_description,
author="The Transifex community and the staff of Indifex",
author_email="[email protected]",
url="http://transifex.org/",
license="GPLv2",
install_requires=requirements,
dependency_links=dependency_links,
zip_safe=False,
packages=find_packages(),
include_package_data=True,
package_data = package_data,
keywords = (
'django.app',
'translation localization internationalization vcs',),
classifiers = [line for line in '''
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Framework :: Django
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License (GPL)
Operating System :: OS Independent
Programming Language :: Python
Topic :: Software Development :: Localization
Topic :: Software Development :: Internationalization
#84 Natural Language :: Catalan
#84 Natural Language :: Chinese (Simplified)
Natural Language :: English
#84 Natural Language :: German
#84 Natural Language :: Greek
#84 Natural Language :: Hungarian
#84 Natural Language :: Italian
#84 Natural Language :: Macedonian
#84 Natural Language :: Malay
#84 Natural Language :: Persian
Natural Language :: Polish
#84 Natural Language :: Portuguese (Brazilian)
#84 Natural Language :: Romanian
#84 Natural Language :: Russian
#84 Natural Language :: Slovak
#84 Natural Language :: Spanish
#84 Natural Language :: Swedish'''.strip().split('\n')
if not line.startswith('#')
],
)