Skip to content

Commit

Permalink
preserve output tmpfile during compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
majuscule committed Mar 28, 2017
1 parent e89fc23 commit 36ba0e1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions piptools/scripts/compile.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,16 +169,16 @@ def cli(verbose, dry_run, pre, rebuild, find_links, index_url, extra_index_url,
# piping from stdin, we need to briefly save the input from stdin
# to a temporary file and have pip read that. also used for
# reading requirements from install_requires in setup.py.
with tempfile.NamedTemporaryFile(mode='wt') as tmpfile:
if is_setup_file:
from distutils.core import run_setup
dist = run_setup(src_file)
tmpfile.write('\n'.join(dist.install_requires))
else:
tmpfile.write(sys.stdin.read())
tmpfile.flush()
constraints.extend(parse_requirements(
tmpfile.name, finder=repository.finder, session=repository.session, options=pip_options))
tmpfile = tempfile.NamedTemporaryFile(mode='wt', delete=False)
if is_setup_file:
from distutils.core import run_setup
dist = run_setup(src_file)
tmpfile.write('\n'.join(dist.install_requires))
else:
tmpfile.write(sys.stdin.read())
tmpfile.flush()
constraints.extend(parse_requirements(
tmpfile.name, finder=repository.finder, session=repository.session, options=pip_options))
else:
constraints.extend(parse_requirements(
src_file, finder=repository.finder, session=repository.session, options=pip_options))
Expand Down

0 comments on commit 36ba0e1

Please sign in to comment.