aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2015-12-12 19:39:24 -0800
committerMike Crute <mcrute@gmail.com>2015-12-12 19:39:24 -0800
commit288ee75257c5d6255983f026c34fad874586654f (patch)
tree9f42088d8587918527b46dd8b368b747df4f91c0 /setup.py
parent61700ac010689903400e872a0e24db324198daa4 (diff)
downloadpydora-288ee75257c5d6255983f026c34fad874586654f.tar.bz2
pydora-288ee75257c5d6255983f026c34fad874586654f.tar.xz
pydora-288ee75257c5d6255983f026c34fad874586654f.zip
Split release tools into new package
Diffstat (limited to 'setup.py')
-rwxr-xr-x[-rw-r--r--]setup.py90
1 files changed, 3 insertions, 87 deletions
diff --git a/setup.py b/setup.py
index 71d72a0..6239173 100644..100755
--- a/setup.py
+++ b/setup.py
@@ -1,84 +1,6 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2 2
3import os 3from setuptools import setup, find_packages
4import sys
5from distutils import log
6from distutils.cmd import Command
7from distutils.errors import DistutilsError
8
9try:
10 from setuptools import setup, find_packages
11except ImportError:
12 from ez_setup import use_setuptools
13 use_setuptools()
14 from setuptools import setup, find_packages
15
16
17class SimpleCommand(Command):
18
19 user_options = []
20
21 def initialize_options(self):
22 pass
23
24 def finalize_options(self):
25 pass
26
27 def install_requires(self):
28 if self.distribution.install_requires:
29 self.distribution.fetch_build_eggs(
30 self.distribution.install_requires)
31
32 if self.distribution.tests_require:
33 self.distribution.fetch_build_eggs(
34 self.distribution.tests_require)
35
36 def run(self):
37 self.install_requires()
38 self._run()
39
40
41class cover_test(SimpleCommand):
42
43 description = "run unit tests with coverage"
44
45 def _run(self):
46 from coverage import coverage
47
48 cov = coverage(data_file=".coverage", branch=True,
49 source=self.distribution.packages)
50 cov.start()
51
52 # Unittest calls exit. How naughty.
53 try:
54 self.run_command("test")
55 except SystemExit:
56 pass
57
58 cov.stop()
59 cov.xml_report(outfile="coverage.xml")
60 cov.html_report()
61
62
63class check_style(SimpleCommand):
64
65 description = "run PEP8 style validations"
66
67 def _run(self):
68 from pep8 import StyleGuide
69
70 self.run_command("egg_info")
71 files = self.get_finalized_command("egg_info")
72
73 report = StyleGuide().check_files([
74 p for p in files.filelist.files if p.endswith(".py")])
75
76 if report.total_errors:
77 msg = "Found {} PEP8 violations".format(report.total_errors)
78 raise DistutilsError(msg)
79 else:
80 log.info("No PEP8 violations found")
81
82 4
83setup( 5setup(
84 name="pydora", 6 name="pydora",
@@ -89,15 +11,9 @@ setup(
89 author_email="mcrute@gmail.com", 11 author_email="mcrute@gmail.com",
90 url="https://github.com/mcrute/pydora", 12 url="https://github.com/mcrute/pydora",
91 test_suite="tests.discover_suite", 13 test_suite="tests.discover_suite",
92 cmdclass={
93 "check_style": check_style,
94 "cover_test": cover_test,
95 },
96 packages=find_packages(exclude=["tests", "tests.*"]), 14 packages=find_packages(exclude=["tests", "tests.*"]),
97 tests_require=[ 15 setup_requires=[
98 "pep8>=1.6.2", 16 "py_release_tools",
99 "mock>=1.0.1",
100 "coverage>=4.0.3",
101 ], 17 ],
102 install_requires=[ 18 install_requires=[
103 "pycrypto>=2.6.1", 19 "pycrypto>=2.6.1",