From 38b30ef01486114edd3d2b2e6dd5bd46d52b7549 Mon Sep 17 00:00:00 2001 From: ronel99 <> Date: Mon, 17 Jun 2024 19:34:12 +0300 Subject: [PATCH] fix pip download with correct version --- src/app/main/routes.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/app/main/routes.py b/src/app/main/routes.py index 650ddda..e62e72a 100644 --- a/src/app/main/routes.py +++ b/src/app/main/routes.py @@ -49,10 +49,11 @@ def index(): elif 'download' in request.form: try: - command = ["pip", "download", package_name, "-d", current_app.config['DOWNLOAD_FOLDER']] - subprocess.run(command, check=True) - package_version = session.get('package_version') + + command = ["pip", "download", f"{package_name}=={package_version}", "-d", current_app.config['DOWNLOAD_FOLDER']] + subprocess.run(command, check=True) + zip_filename = f"{package_name}_{package_version}.zip" zip_filepath = os.path.join(current_app.config['ZIP_FOLDER'], zip_filename) with zipfile.ZipFile(zip_filepath, 'w') as zipf: