File tree Expand file tree Collapse file tree 1 file changed +18
-26
lines changed
Expand file tree Collapse file tree 1 file changed +18
-26
lines changed Original file line number Diff line number Diff line change @@ -25,40 +25,32 @@ def version():
2525 _ , version = line .split ('=' )
2626 return version .replace ("'" , '' ).strip ()
2727
28+ def is_ignored (line ):
29+ line = line .strip ()
30+ return (not line ) or (line [0 ] == "#" )
2831
29- def load_deps (section ):
30- """Load dependencies from Pipfile, we can't assume toml is installed"""
31- # [packages]
32- header = '[{}]' .format (section )
33- with open ('Pipfile' ) as fp :
34- in_section = False
32+ def load_deps (path ):
33+ """Load dependencies from requirements file"""
34+ with open (path ) as fp :
35+ deps = []
3536 for line in fp :
36- line = line .strip ()
37- if not line :
38- continue
39-
40- if line == header :
41- in_section = True
37+ if is_ignored (line ):
4238 continue
39+ line = line .strip ()
4340
44- if line .startswith ('[' ):
45- in_section = False
41+ # e.g.: git+https://github.com/nuclio/nuclio-jupyter.git@some-branch#egg=nuclio-jupyter
42+ if "#egg=" in line :
43+ _ , package = line .split ("#egg=" )
44+ deps .append (f"{ package } @ { line } " )
4645 continue
4746
48- if in_section :
49- # ipython = ">=6.5"
50- i = line .find ('=' )
51- assert i != - 1 , 'bad dependency - {}' .format (line )
52- pkg = line [:i ].strip ()
53- version = line [i + 1 :].strip ().replace ('"' , '' )
54- if version == '*' :
55- yield pkg
56- else :
57- yield '{}{}' .format (pkg , version .replace ('"' , '' ))
47+ # append package
48+ deps .append (line )
49+ return deps
5850
5951
60- install_requires = list ( load_deps ('packages' ) )
61- tests_require = list ( load_deps ('dev-packages' ) )
52+ install_requires = load_deps ('requirements.txt' )
53+ tests_require = load_deps ('dev-requirements.txt' )
6254
6355with open ('README.md' ) as fp :
6456 long_desc = fp .read ()
You can’t perform that action at this time.
0 commit comments