##// END OF EJS Templates
setup-py: restructured the file to be in synced with other projects.
marcink -
r136:90271e3a default
parent child Browse files
Show More
@@ -1,103 +1,132 b''
1 # -*- coding: utf-8 -*-
1 2 # RhodeCode VCSServer provides access to different vcs backends via network.
2 3 # Copyright (C) 2014-2016 RodeCode GmbH
3 4 #
4 5 # This program is free software; you can redistribute it and/or modify
5 6 # it under the terms of the GNU General Public License as published by
6 7 # the Free Software Foundation; either version 3 of the License, or
7 8 # (at your option) any later version.
8 9 #
9 10 # This program is distributed in the hope that it will be useful,
10 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 13 # GNU General Public License for more details.
13 14 #
14 15 # You should have received a copy of the GNU General Public License
15 16 # along with this program; if not, write to the Free Software Foundation,
16 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 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 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:
29 long_description = f.read()
50 try:
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 72 def get_version():
33 73 version = pkgutil.get_data('vcsserver', 'VERSION')
34 74 return version.strip()
35 75
36 76
37 class PyTest(TestCommand):
38 user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
77 # additional files that goes into package itself
78 package_data = {
79 '': ['*.txt', '*.rst'],
80 'configs': ['*.ini'],
81 'vcsserver': ['VERSION'],
82 }
39 83
40 def initialize_options(self):
41 TestCommand.initialize_options(self)
42 self.pytest_args = []
84 description = 'Version Control System Server'
85 keywords = ' '.join([
86 'CLI', 'RhodeCode', 'RhodeCode Enterprise', 'RhodeCode Tools'])
43 87
44 def finalize_options(self):
45 TestCommand.finalize_options(self)
46 self.test_args = []
47 self.test_suite = True
48
49 def run_tests(self):
50 # import here, cause outside the eggs aren't loaded
51 import pytest
52 errno = pytest.main(self.pytest_args)
53 sys.exit(errno)
88 # README/DESCRIPTION generation
89 readme_file = 'README.rst'
90 changelog_file = 'CHANGES.rst'
91 try:
92 long_description = open(readme_file).read() + '\n\n' + \
93 open(changelog_file).read()
94 except IOError as err:
95 sys.stderr.write(
96 "[WARNING] Cannot find file specified as long_description (%s)\n "
97 "or changelog (%s) skipping that file" % (readme_file, changelog_file))
98 long_description = description
54 99
55 100
56 101 setup(
57 102 name='rhodecode-vcsserver',
58 103 version=get_version(),
59 description='Version Control System Server',
104 description=description,
60 105 long_description=long_description,
61 url='http://www.rhodecode.com',
62 author='RhodeCode GmbH',
106 keywords=keywords,
107 license=__license__,
108 author=__author__,
63 109 author_email='marcin@rhodecode.com',
64 cmdclass={'test': PyTest},
65 license='GPLv3',
110 url=__url__,
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 118 classifiers=[
67 'Development Status :: 5 - Production/Stable',
119 'Development Status :: 6 - Mature',
68 120 'Intended Audience :: Developers',
121 'Operating System :: OS Independent',
69 122 'Topic :: Software Development :: Version Control',
70 123 'License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)',
71 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 126 entry_points={
98 127 'console_scripts': [
99 128 'vcsserver=vcsserver.main:main',
100 129 ],
101 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