Skip to content

Commit

Permalink
Check install_requires/extras_require for nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
atugushev committed Aug 20, 2019
1 parent c27c161 commit 78a1c13
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,19 +302,21 @@ def cli(
from distutils.core import run_setup

dist = run_setup(src_file)
tmpfile.write("\n".join(dist.install_requires))
if dist.install_requires:
tmpfile.write("\n".join(dist.install_requires))

# Parse extras_require of the form
# "extra:{marker}": ["package"] to
# "package ; {marker}" if extra is empty.
for extra_and_marker, packages in dist.extras_require.items():
extra, marker = extra_and_marker.split(":")
# TODO: non-empty extras will be ignored, perhaps we need
# an option like --with-extra to specify one. See GH-625.
if extra:
continue
for package in packages:
tmpfile.write("{} ; {}\n".format(package, marker))
if dist.extras_require:
for extra_and_marker, packages in dist.extras_require.items():
extra, marker = extra_and_marker.split(":")
# TODO: non-empty extras will be ignored, perhaps we need
# an option like --with-extra to specify one. See GH-625.
if extra:
continue
for package in packages:
tmpfile.write("{} ; {}\n".format(package, marker))
else:
tmpfile.write(sys.stdin.read())
tmpfile.flush()
Expand Down

0 comments on commit 78a1c13

Please sign in to comment.