3
3
import os
4
4
from setuptools import setup
5
5
from setuptools .command .test import test as TestCommand
6
+ from setuptools import Command
6
7
7
8
8
9
# see http://fgimian.github.io/blog/2014/04/27/running-nose-tests-with-plugins-using-the-python-setuptools-test-command
@@ -19,9 +20,29 @@ def run_tests(self):
19
20
nose .run_exit (argv = ["nosetests" , "--with-coverage" , "--cover-package=pycaching" ])
20
21
21
22
23
+ class LintCommand (Command ):
24
+ user_options = []
25
+
26
+ def initialize_options (self ):
27
+ pass
28
+
29
+ def finalize_options (self ):
30
+ pass
31
+
32
+ def run (self ):
33
+ import flake8 .main
34
+ import sys
35
+ sys .argv = []
36
+ flake8 .main .main ()
37
+
38
+
22
39
root = os .path .dirname (__file__ ) or "."
23
- f = open (os .path .join (root , "README.rst" ))
24
- long_description = f .read ()
40
+
41
+ with open (os .path .join (root , "README.rst" )) as f :
42
+ long_description = f .read ()
43
+
44
+ with open (os .path .join (root , "requirements.txt" )) as f :
45
+ requirements = list (filter (None , (row .strip () for row in f )))
25
46
26
47
info = {
27
48
"name" : "pycaching" ,
@@ -35,9 +56,9 @@ def run_tests(self):
35
56
"description" : "Geocaching.com site crawler. Provides tools for searching, fetching caches and geocoding." ,
36
57
"long_description" : long_description ,
37
58
"keywords" : ["geocaching" , "crawler" , "geocache" , "cache" , "search" , "geocode" , "travelbug" ],
38
- "install_requires" : [ "requests >= 2.8" , "beautifulsoup4 >= 4.4" , "geopy >= 1.11" ] ,
39
- "setup_requires" : ["nose >= 1.3 " , "flake8 >= 2.4.0 " , "coverage >= 3.7 " ],
40
- "cmdclass" : {"test" : NoseTestCommand },
59
+ "install_requires" : requirements ,
60
+ "setup_requires" : ["nose" , "flake8" , "coverage" ],
61
+ "cmdclass" : {"test" : NoseTestCommand , "lint" : LintCommand },
41
62
}
42
63
43
64
setup (** info )
0 commit comments