23
23
from setuptools import setup , find_packages
24
24
25
25
26
- def _load_requires_from_file (filepath ):
26
+ def take_package_name (name ):
27
+ """Returns a package name.
28
+ """
29
+ if name .startswith ("-e" ):
30
+ return name [name .find ("=" )+ 1 :name .rfind ("-" )]
31
+ else :
32
+ return name .strip ()
33
+
34
+
35
+ def load_requires_from_file (filepath ):
27
36
"""Read a package list from a given file path.
37
+ """
38
+ with open (filepath ) as fp :
39
+ return [take_package_name (pkg_name ) for pkg_name in fp .readlines ()]
28
40
29
- Args:
30
- filepath: file path of the package list.
31
41
32
- Returns :
33
- a list of package names .
42
+ def load_links_from_file ( filepath ) :
43
+ """Read a package list and returns links .
34
44
"""
45
+ res = []
35
46
with open (filepath ) as fp :
36
- return [pkg_name .strip () for pkg_name in fp .readlines ()]
47
+ for pkg_name in fp .readlines ():
48
+ if pkg_name .startswith ("-e" ):
49
+ res .append (pkg_name .split (" " )[1 ])
50
+ return res
37
51
38
52
39
53
setup (
@@ -44,7 +58,8 @@ def _load_requires_from_file(filepath):
44
58
description = "An implementation of RSD algorithm" ,
45
59
url = "https://github.com/rgmining/rsd" ,
46
60
packages = find_packages (exclude = ["tests" ]),
47
- install_requires = _load_requires_from_file ("requirements.txt" ),
61
+ install_requires = load_requires_from_file ("requirements.txt" ),
62
+ dependency_links = load_links_from_file ("requirements.txt" ),
48
63
test_suite = 'tests.suite' ,
49
64
license = "GPLv3" ,
50
65
classifiers = [
0 commit comments