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

Unified 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.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « abp/filters/__init__.py ('k') | tests/test_line_parsing.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: setup.py
===================================================================
new file mode 100644
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,118 @@
+# This file is part of Adblock Plus <https://adblockplus.org/>,
+# Copyright (C) 2006-2016 Eyeo GmbH
+#
+# Adblock Plus is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 3 as
+# published by the Free Software Foundation.
+#
+# Adblock Plus is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
+
+import subprocess
+from os import path
+from setuptools import setup, Command
+
+
+PACKAGE = 'python-abp'
+DEVENV = 'devenv'
+MODULE = 'abp'
+TESTS = 'tests'
+
+PYTHON = path.join(DEVENV, 'bin', 'python')
+PIP = path.join(DEVENV, 'bin', 'pip')
+PYTEST = path.join(DEVENV, 'bin', 'py.test')
+TOX = path.join(DEVENV, 'bin', 'tox')
+FLAKE8 = path.join(DEVENV, 'bin', 'flake8')
+AUTOPEP8 = path.join(DEVENV, 'bin', 'autopep8')
+
+DEV_DEPENDENCIES = ['pytest', 'pytest-cov', 'tox', 'flake8']
+
+
+def make_command(func):
+ """Converting function to a command suitable for use with setup."""
+
+ class CmdClass(Command):
+
+ description = func.__doc__[0].lower() + func.__doc__[1:-1]
+ user_options = []
+
+ def initialize_options(self):
+ pass
+
+ def finalize_options(self):
+ pass
+
+ def run(self):
+ func()
+
+ return CmdClass
+
+
+def devenv():
+ """Create development virtualenv."""
+ if not path.isdir(DEVENV):
+ subprocess.check_call(['virtualenv', DEVENV])
+ subprocess.check_call([PIP, 'install'] + DEV_DEPENDENCIES)
+ subprocess.check_call([PYTHON, 'setup.py', 'develop'])
+
+
+def syntaxcheck():
+ """Find PEP8 violations and common errors with flake8."""
+ devenv()
+ subprocess.call([FLAKE8, MODULE, TESTS])
+
+
+def test():
+ """Run tests with py.test."""
+ devenv()
+ subprocess.call([PYTEST, TESTS])
+
+
+def testall():
+ """Run tests with all supported python versions using tox."""
+ devenv()
+ subprocess.call([TOX])
+
+
+def testcov():
+ """Produce test coverage report."""
+ devenv()
+ subprocess.call([PYTEST, '--cov=' + MODULE, TESTS])
+
+
+setup(
+ name=PACKAGE,
+ version='0.0.1',
+ description='ABP python tools',
+ long_description="A library for working with Adblock Plus filterlists.",
+ author='Vasily Kuznetsov',
+ author_email='vasily@adblockplus.org',
+ url='https://hg.adblockplus.org/python-abp/',
+ packages=['abp', 'abp.filters'],
+ cmdclass={
+ 'devenv': make_command(devenv),
+ 'syntaxcheck': make_command(syntaxcheck),
+ 'test': make_command(test),
+ 'testall': make_command(testall),
+ 'testcov': make_command(testcov),
+ },
+ include_package_data=True,
+ license='GPLv3',
+ zip_safe=False,
+ keywords='filterlist adblockplus ABP',
+ classifiers=[
+ 'Development Status :: 2 - Pre-Alpha',
+ 'Intended Audience :: Developers',
+ 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
+ 'Natural Language :: English',
+ 'Programming Language :: Python :: 2',
+ 'Programming Language :: Python :: 2.7',
+ 'Programming Language :: Python :: 3',
+ 'Programming Language :: Python :: 3.5',
+ ]
+)
« 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