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