Skip to content

Commit

Permalink
fix pip download with correct version
Browse files Browse the repository at this point in the history
  • Loading branch information
ronel99 committed Jun 17, 2024
1 parent 50bf4e4 commit 38b30ef
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/app/main/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 38b30ef

Please sign in to comment.