Skip to content

Commit a380656

Browse files
committed
update test
1 parent be97cc6 commit a380656

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ Details:
206206
1. Freeze package versions of pip args with venv, output to the given file path.
207207
1. `-` equals to `stdout`
208208
2. logs will be redirect to `stderr`
209-
2. It tasks time for: init venv + pip install + pip freeze
209+
2. Based on `pip` + `venv`
210210
1. work folder is `tempfile.TemporaryDirectory`, prefix='zipapps_'
211211
26. all the other (or `unknown`) args will be used by `pip install`
212212
1. such as `-r requirements.txt`

changelog.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- Freeze package versions of pip args with venv, output to the given file path.
1010
- `-` equals to `stdout`
1111
- logs will be redirect to `stderr`
12-
- It tasks time for: init venv + pip install + pip freeze
12+
- Based on `pip` + `venv`
1313
- the work folder is `tempfile.TemporaryDirectory`, prefix='zipapps_'
1414
- support clear self pyz after running fix #21
1515
- refactor environment variables template and interval variables(with string.Template) #23

zipapps/freezing.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def install_env(self):
6161
venv_path = self.temp_path / self.VENV_NAME
6262
self.log(f'Initial venv with pip: {venv_path.absolute()}')
6363
if self.FASTER_PREPARE_PIP:
64-
venv.create(env_dir=venv_path, with_pip=False)
64+
venv.create(env_dir=venv_path, system_site_packages=False, with_pip=False)
6565
import shutil
6666

6767
import pip
@@ -73,7 +73,7 @@ def install_env(self):
7373
target = venv_path / 'lib' / pyv / 'site-packages' / 'pip'
7474
shutil.copytree(pip_dir, target)
7575
else:
76-
venv.create(env_dir=venv_path, with_pip=True)
76+
venv.create(env_dir=venv_path, system_site_packages=False, with_pip=True)
7777
if not venv_path.is_dir():
7878
raise FileNotFoundError(str(venv_path))
7979

@@ -108,8 +108,10 @@ def install_packages(self):
108108
return result
109109

110110
def freeze_requirements(self, output):
111-
print(output, flush=True)
112-
if self.output_path != '-':
111+
if self.output_path == '-':
112+
print(output, flush=True)
113+
else:
114+
print(output, file=sys.stderr, flush=True)
113115
with open(self.output_path, 'w', encoding='utf-8') as f:
114116
print(output, file=f, flush=True)
115117

0 commit comments

Comments
 (0)