aboutsummaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2015-07-20 09:37:59 -0700
committerMike Crute <mcrute@gmail.com>2015-07-20 09:41:12 -0700
commite2bb2230260f50a679c1549c824b51ad5871e61f (patch)
treef1bb8585c73393b3de5c87a3dd33e280f97266a9 /setup.py
parent966a0867182a1e8e77fd45ff763f9166548332ec (diff)
downloadpydora-e2bb2230260f50a679c1549c824b51ad5871e61f.tar.bz2
pydora-e2bb2230260f50a679c1549c824b51ad5871e61f.tar.xz
pydora-e2bb2230260f50a679c1549c824b51ad5871e61f.zip
Fix setup.py import
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py62
1 files changed, 59 insertions, 3 deletions
diff --git a/setup.py b/setup.py
index dea37fa..fa2a0b7 100644
--- a/setup.py
+++ b/setup.py
@@ -1,5 +1,11 @@
1#!/usr/bin/env python 1#!/usr/bin/env python
2 2
3import os
4import sys
5from distutils import log
6from distutils.cmd import Command
7from distutils.errors import DistutilsError
8
3try: 9try:
4 from setuptools import setup, find_packages 10 from setuptools import setup, find_packages
5except ImportError: 11except ImportError:
@@ -7,7 +13,57 @@ except ImportError:
7 use_setuptools() 13 use_setuptools()
8 from setuptools import setup, find_packages 14 from setuptools import setup, find_packages
9 15
10import distutils_ext 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
28class cover_test(SimpleCommand):
29
30 description = "run unit tests with coverage"
31
32 def run(self):
33 from coverage import coverage
34
35 cov = coverage(data_file=".coverage", branch=True,
36 source=self.distribution.packages)
37 cov.start()
38
39 # Unittest calls exit. How naughty.
40 try:
41 self.run_command("test")
42 except SystemExit:
43 pass
44
45 cov.stop()
46 cov.xml_report(outfile="coverage.xml")
47
48
49class check_style(SimpleCommand):
50
51 description = "run PEP8 style validations"
52
53 def run(self):
54 from pep8 import StyleGuide
55
56 self.run_command("egg_info")
57 files = self.get_finalized_command("egg_info")
58
59 report = StyleGuide().check_files([
60 p for p in files.filelist.files if p.endswith(".py")])
61
62 if report.total_errors:
63 msg = "Found {} PEP8 violations".format(report.total_errors)
64 raise DistutilsError(msg)
65 else:
66 log.info("No PEP8 violations found")
11 67
12 68
13setup( 69setup(
@@ -20,8 +76,8 @@ setup(
20 url="https://github.com/mcrute/pydora", 76 url="https://github.com/mcrute/pydora",
21 test_suite="tests.discover_suite", 77 test_suite="tests.discover_suite",
22 cmdclass={ 78 cmdclass={
23 "check_style": distutils_ext.check_style, 79 "check_style": check_style,
24 "cover_test": distutils_ext.cover_test, 80 "cover_test": cover_test,
25 }, 81 },
26 packages=find_packages(exclude=["tests", "tests.*"]), 82 packages=find_packages(exclude=["tests", "tests.*"]),
27 tests_require=[ 83 tests_require=[