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

Side by Side Diff: setup.py

Issue 29338156: Issue 3754 - Initial setup of the python-abp repo. (Closed)
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.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « abp/filters/__init__.py ('k') | tests/test_line_parsing.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # This file is part of Adblock Plus <https://adblockplus.org/>,
2 # Copyright (C) 2006-2016 Eyeo GmbH
3 #
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
6 # published by the Free Software Foundation.
7 #
8 # Adblock Plus is distributed in the hope that it will be useful,
9 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # GNU General Public License for more details.
12 #
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/>.
15
16 import subprocess
17 from os import path
18 from setuptools import setup, Command
19
20
21 PACKAGE = 'python-abp'
22 DEVENV = 'devenv'
23 MODULE = 'abp'
24 TESTS = 'tests'
25
26 PYTHON = path.join(DEVENV, 'bin', 'python')
27 PIP = path.join(DEVENV, 'bin', 'pip')
28 PYTEST = path.join(DEVENV, 'bin', 'py.test')
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
35
36 def make_command(func):
37 """Converting function to a command suitable for use with setup."""
38
39 class CmdClass(Command):
40
41 description = func.__doc__[0].lower() + func.__doc__[1:-1]
42 user_options = []
43
44 def initialize_options(self):
45 pass
46
47 def finalize_options(self):
48 pass
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)
61 subprocess.check_call([PYTHON, 'setup.py', 'develop'])
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
87
88 setup(
89 name=PACKAGE,
90 version='0.0.1',
91 description='ABP python tools',
92 long_description="A library for working with Adblock Plus filterlists.",
93 author='Vasily Kuznetsov',
94 author_email='vasily@adblockplus.org',
95 url='https://hg.adblockplus.org/python-abp/',
96 packages=['abp', 'abp.filters'],
97 cmdclass={
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,
105 license='GPLv3',
106 zip_safe=False,
107 keywords='filterlist adblockplus ABP',
108 classifiers=[
109 'Development Status :: 2 - Pre-Alpha',
110 'Intended Audience :: Developers',
111 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
112 'Natural Language :: English',
113 'Programming Language :: Python :: 2',
114 'Programming Language :: Python :: 2.7',
115 'Programming Language :: Python :: 3',
116 'Programming Language :: Python :: 3.5',
117 ]
118 )
OLDNEW
« no previous file with comments | « abp/filters/__init__.py ('k') | tests/test_line_parsing.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld