Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: setup.py

Issue 29338156: Issue 3754 - Initial setup of the python-abp repo. (Closed)
Left Patch Set: Address review comments (ignore files, extra commands in setup.py, license text in readme, etc.) Created March 15, 2016, 4:28 p.m.
Right Patch Set: Remove pytest from qa dependencies in tox.ini, change "filterlist" to "filter list" Created March 17, 2016, 2:39 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « abp/filters/__init__.py ('k') | tests/test_line_parsing.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 # This file is part of Adblock Plus <https://adblockplus.org/>, 1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-2016 Eyeo GmbH 2 # Copyright (C) 2006-2016 Eyeo GmbH
3 # 3 #
4 # Adblock Plus is free software: you can redistribute it and/or modify 4 # Adblock Plus is free software: you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License version 3 as 5 # it under the terms of the GNU General Public License version 3 as
6 # published by the Free Software Foundation. 6 # published by the Free Software Foundation.
7 # 7 #
8 # Adblock Plus is distributed in the hope that it will be useful, 8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of 9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details. 11 # GNU General Public License for more details.
12 # 12 #
13 # You should have received a copy of the GNU General Public License 13 # You should have received a copy of the GNU General Public License
14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 14 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
15 15
16 import subprocess 16 import subprocess
17 from os import path 17 from os import path
18 from setuptools import setup, Command 18 from setuptools import setup, Command
19 19
20 20
21 PACKAGE = 'python-abp'
22 DEVENV = 'devenv' 21 DEVENV = 'devenv'
23 MODULE = 'abp'
24 TESTS = 'tests'
25
26 PYTHON = path.join(DEVENV, 'bin', 'python')
27 PIP = path.join(DEVENV, 'bin', 'pip') 22 PIP = path.join(DEVENV, 'bin', 'pip')
28 PYTEST = path.join(DEVENV, 'bin', 'py.test') 23 DEV_DEPENDENCIES = ['pytest', 'tox']
29 TOX = path.join(DEVENV, 'bin', 'tox')
30 FLAKE8 = path.join(DEVENV, 'bin', 'flake8')
31 AUTOPEP8 = path.join(DEVENV, 'bin', 'autopep8')
32
33 DEV_DEPENDENCIES = ['pytest', 'pytest-cov', 'tox', 'flake8']
34 24
35 25
36 def make_command(func): 26 class devenv(Command):
37 """Converting function to a command suitable for use with setup.""" 27 """Set up development virtualenv."""
38 28
39 class CmdClass(Command): 29 description = "set up development virtualenv"
30 user_options = [('python=', 'p', "the python interpreter to use")]
40 31
41 description = func.__doc__[0].lower() + func.__doc__[1:-1] 32 def initialize_options(self):
42 user_options = [] 33 self.python = 'python'
43 34
44 def initialize_options(self): 35 def finalize_options(self):
45 pass 36 pass
46 37
47 def finalize_options(self): 38 def run(self):
48 pass 39 subprocess.check_call(['virtualenv', '-p', self.python, DEVENV])
49
50 def run(self):
51 func()
52
53 return CmdClass
54
55
56 def devenv():
57 """Create development virtualenv."""
58 if not path.isdir(DEVENV):
59 subprocess.check_call(['virtualenv', DEVENV])
60 subprocess.check_call([PIP, 'install'] + DEV_DEPENDENCIES) 40 subprocess.check_call([PIP, 'install'] + DEV_DEPENDENCIES)
61 subprocess.check_call([PYTHON, 'setup.py', 'develop']) 41 subprocess.check_call([PIP, 'install', '-e', '.'])
62
63
64 def syntaxcheck():
65 """Find PEP8 violations and common errors with flake8."""
66 devenv()
67 subprocess.call([FLAKE8, MODULE, TESTS])
68
69
70 def test():
71 """Run tests with py.test."""
72 devenv()
73 subprocess.call([PYTEST, TESTS])
74
75
76 def testall():
77 """Run tests with all supported python versions using tox."""
78 devenv()
79 subprocess.call([TOX])
80
81
82 def testcov():
83 """Produce test coverage report."""
84 devenv()
85 subprocess.call([PYTEST, '--cov=' + MODULE, TESTS])
86 42
87 43
88 setup( 44 setup(
89 name=PACKAGE, 45 name='python-abp',
90 version='0.0.1', 46 version='0.0.1',
91 description='ABP python tools', 47 description='ABP python tools',
92 long_description="A library for working with Adblock Plus filterlists.", 48 long_description="A library for working with Adblock Plus filter lists.",
93 author='Vasily Kuznetsov', 49 author='Vasily Kuznetsov',
94 author_email='vasily@adblockplus.org', 50 author_email='vasily@adblockplus.org',
95 url='https://hg.adblockplus.org/python-abp/', 51 url='https://hg.adblockplus.org/python-abp/',
96 packages=['abp', 'abp.filters'], 52 packages=['abp', 'abp.filters'],
97 cmdclass={ 53 cmdclass={'devenv': devenv},
98 'devenv': make_command(devenv),
99 'syntaxcheck': make_command(syntaxcheck),
100 'test': make_command(test),
101 'testall': make_command(testall),
102 'testcov': make_command(testcov),
103 },
104 include_package_data=True, 54 include_package_data=True,
105 license='GPLv3', 55 license='GPLv3',
106 zip_safe=False, 56 zip_safe=False,
107 keywords='filterlist adblockplus ABP', 57 keywords='filterlist adblockplus ABP',
108 classifiers=[ 58 classifiers=[
109 'Development Status :: 2 - Pre-Alpha', 59 'Development Status :: 2 - Pre-Alpha',
110 'Intended Audience :: Developers', 60 'Intended Audience :: Developers',
111 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', 61 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
112 'Natural Language :: English', 62 'Natural Language :: English',
113 'Programming Language :: Python :: 2', 63 'Programming Language :: Python :: 2',
114 'Programming Language :: Python :: 2.7', 64 'Programming Language :: Python :: 2.7',
115 'Programming Language :: Python :: 3', 65 'Programming Language :: Python :: 3',
116 'Programming Language :: Python :: 3.5', 66 'Programming Language :: Python :: 3.5',
117 ] 67 ]
118 ) 68 )
LEFTRIGHT

Powered by Google App Engine
This is Rietveld