diff --git a/piptools/scripts/compile.py b/piptools/scripts/compile.py index 3fb50409e..5a1521937 100755 --- a/piptools/scripts/compile.py +++ b/piptools/scripts/compile.py @@ -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()