##// END OF EJS Templates
setup: use pip10 compatible setup code.
marcink -
r493:a71caae1 default
parent child Browse files
Show More
@@ -1,132 +1,139 b''
1 # -*- coding: utf-8 -*-
1 # -*- coding: utf-8 -*-
2 # RhodeCode VCSServer provides access to different vcs backends via network.
2 # RhodeCode VCSServer provides access to different vcs backends via network.
3 # Copyright (C) 2014-2017 RodeCode GmbH
3 # Copyright (C) 2014-2017 RodeCode GmbH
4 #
4 #
5 # This program is free software; you can redistribute it and/or modify
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
8 # (at your option) any later version.
9 #
9 #
10 # This program is distributed in the hope that it will be useful,
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
13 # GNU General Public License for more details.
14 #
14 #
15 # You should have received a copy of the GNU General Public License
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
19 # Import early to make sure things are patched up properly
19 # Import early to make sure things are patched up properly
20 from setuptools import setup, find_packages
20 from setuptools import setup, find_packages
21
21
22 import os
22 import os
23 import sys
23 import sys
24 import pkgutil
24 import pkgutil
25 import platform
25 import platform
26 import codecs
26
27
27 from pip.download import PipSession
28 try: # for pip >= 10
28 from pip.req import parse_requirements
29 from pip._internal.req import parse_requirements
30 except ImportError: # for pip <= 9.0.3
31 from pip.req import parse_requirements
29
32
30 from codecs import open
33 try: # for pip >= 10
34 from pip._internal.download import PipSession
35 except ImportError: # for pip <= 9.0.3
36 from pip.download import PipSession
37
31
38
32
39
33 if sys.version_info < (2, 7):
40 if sys.version_info < (2, 7):
34 raise Exception('VCSServer requires Python 2.7 or later')
41 raise Exception('VCSServer requires Python 2.7 or later')
35
42
36 here = os.path.abspath(os.path.dirname(__file__))
43 here = os.path.abspath(os.path.dirname(__file__))
37
44
38 # defines current platform
45 # defines current platform
39 __platform__ = platform.system()
46 __platform__ = platform.system()
40 __license__ = 'GPL V3'
47 __license__ = 'GPL V3'
41 __author__ = 'RhodeCode GmbH'
48 __author__ = 'RhodeCode GmbH'
42 __url__ = 'https://code.rhodecode.com'
49 __url__ = 'https://code.rhodecode.com'
43 is_windows = __platform__ in ('Windows',)
50 is_windows = __platform__ in ('Windows',)
44
51
45
52
46 def _get_requirements(req_filename, exclude=None, extras=None):
53 def _get_requirements(req_filename, exclude=None, extras=None):
47 extras = extras or []
54 extras = extras or []
48 exclude = exclude or []
55 exclude = exclude or []
49
56
50 try:
57 try:
51 parsed = parse_requirements(
58 parsed = parse_requirements(
52 os.path.join(here, req_filename), session=PipSession())
59 os.path.join(here, req_filename), session=PipSession())
53 except TypeError:
60 except TypeError:
54 # try pip < 6.0.0, that doesn't support session
61 # try pip < 6.0.0, that doesn't support session
55 parsed = parse_requirements(os.path.join(here, req_filename))
62 parsed = parse_requirements(os.path.join(here, req_filename))
56
63
57 requirements = []
64 requirements = []
58 for ir in parsed:
65 for ir in parsed:
59 if ir.req and ir.name not in exclude:
66 if ir.req and ir.name not in exclude:
60 requirements.append(str(ir.req))
67 requirements.append(str(ir.req))
61 return requirements + extras
68 return requirements + extras
62
69
63
70
64 # requirements extract
71 # requirements extract
65 setup_requirements = ['pytest-runner']
72 setup_requirements = ['pytest-runner']
66 install_requirements = _get_requirements(
73 install_requirements = _get_requirements(
67 'requirements.txt', exclude=['setuptools'])
74 'requirements.txt', exclude=['setuptools'])
68 test_requirements = _get_requirements(
75 test_requirements = _get_requirements(
69 'requirements_test.txt', extras=['configobj'])
76 'requirements_test.txt', extras=['configobj'])
70
77
71
78
72 def get_version():
79 def get_version():
73 version = pkgutil.get_data('vcsserver', 'VERSION')
80 version = pkgutil.get_data('vcsserver', 'VERSION')
74 return version.strip()
81 return version.strip()
75
82
76
83
77 # additional files that goes into package itself
84 # additional files that goes into package itself
78 package_data = {
85 package_data = {
79 '': ['*.txt', '*.rst'],
86 '': ['*.txt', '*.rst'],
80 'configs': ['*.ini'],
87 'configs': ['*.ini'],
81 'vcsserver': ['VERSION'],
88 'vcsserver': ['VERSION'],
82 }
89 }
83
90
84 description = 'Version Control System Server'
91 description = 'Version Control System Server'
85 keywords = ' '.join([
92 keywords = ' '.join([
86 'CLI', 'RhodeCode', 'RhodeCode Enterprise', 'RhodeCode Tools'])
93 'CLI', 'RhodeCode', 'RhodeCode Enterprise', 'RhodeCode Tools'])
87
94
88 # README/DESCRIPTION generation
95 # README/DESCRIPTION generation
89 readme_file = 'README.rst'
96 readme_file = 'README.rst'
90 changelog_file = 'CHANGES.rst'
97 changelog_file = 'CHANGES.rst'
91 try:
98 try:
92 long_description = open(readme_file).read() + '\n\n' + \
99 long_description = codecs.open(readme_file).read() + '\n\n' + \
93 open(changelog_file).read()
100 codecs.open(changelog_file).read()
94 except IOError as err:
101 except IOError as err:
95 sys.stderr.write(
102 sys.stderr.write(
96 "[WARNING] Cannot find file specified as long_description (%s)\n "
103 "[WARNING] Cannot find file specified as long_description (%s)\n "
97 "or changelog (%s) skipping that file" % (readme_file, changelog_file))
104 "or changelog (%s) skipping that file" % (readme_file, changelog_file))
98 long_description = description
105 long_description = description
99
106
100
107
101 setup(
108 setup(
102 name='rhodecode-vcsserver',
109 name='rhodecode-vcsserver',
103 version=get_version(),
110 version=get_version(),
104 description=description,
111 description=description,
105 long_description=long_description,
112 long_description=long_description,
106 keywords=keywords,
113 keywords=keywords,
107 license=__license__,
114 license=__license__,
108 author=__author__,
115 author=__author__,
109 author_email='marcin@rhodecode.com',
116 author_email='marcin@rhodecode.com',
110 url=__url__,
117 url=__url__,
111 setup_requires=setup_requirements,
118 setup_requires=setup_requirements,
112 install_requires=install_requirements,
119 install_requires=install_requirements,
113 tests_require=test_requirements,
120 tests_require=test_requirements,
114 zip_safe=False,
121 zip_safe=False,
115 packages=find_packages(exclude=["docs", "tests*"]),
122 packages=find_packages(exclude=["docs", "tests*"]),
116 package_data=package_data,
123 package_data=package_data,
117 include_package_data=True,
124 include_package_data=True,
118 classifiers=[
125 classifiers=[
119 'Development Status :: 6 - Mature',
126 'Development Status :: 6 - Mature',
120 'Intended Audience :: Developers',
127 'Intended Audience :: Developers',
121 'Operating System :: OS Independent',
128 'Operating System :: OS Independent',
122 'Topic :: Software Development :: Version Control',
129 'Topic :: Software Development :: Version Control',
123 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
130 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
124 'Programming Language :: Python :: 2.7',
131 'Programming Language :: Python :: 2.7',
125 ],
132 ],
126 entry_points={
133 entry_points={
127 'console_scripts': [
134 'console_scripts': [
128 'vcsserver=vcsserver.main:main',
135 'vcsserver=vcsserver.main:main',
129 ],
136 ],
130 'paste.app_factory': ['main=vcsserver.http_main:main']
137 'paste.app_factory': ['main=vcsserver.http_main:main']
131 },
138 },
132 )
139 )
General Comments 0
You need to be logged in to leave comments. Login now