Skip to content

Commit

Permalink
small fixes, add todos
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharsadhwani committed Jun 30, 2024
1 parent ef7e91b commit 4fc3319
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ jobs:
sudo apt update
sudo apt install libc6:i386
- name: Install dependencies
run: |
pip install -r requirements-dev.txt
run: pip install -r requirements-dev.txt

- name: Run tests and type checking
run: tox -e ${{matrix.tox-env }}
2 changes: 2 additions & 0 deletions src/yen/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ def ensure_python(python_version: str, force_32bit: bool) -> tuple[str, str]:
return python_folder_name, python_bin_path

python_version, download_link = resolve_python_version(python_version, force_32bit)
# TODO: use suffix_32bit here
download_directory = os.path.join(PYTHON_INSTALLS_PATH, python_version)

os.makedirs(download_directory, exist_ok=True)
Expand Down Expand Up @@ -196,6 +197,7 @@ def install_package(
else:
shim_path += ".exe"

# TODO: use suffix_32bit here
venv_name = f"venv_{package_name}"
venv_path = os.path.join(PACKAGE_INSTALLS_PATH, venv_name)
if os.path.exists(shim_path):
Expand Down
16 changes: 12 additions & 4 deletions src/yen/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,18 @@ def cli() -> int:
args = parser.parse_args(namespace=YenArgs)

if args.command == "list":
versions = list(list_pythons(args.force_32bit))
print("Available Pythons:", file=sys.stderr)
for version in versions:
print(version)
try:
versions = list(list_pythons(args.force_32bit))
print("Available Pythons:", file=sys.stderr)
for version in versions:
print(version)
except NotAvailable:
print(
"No Python versions available for your machine. "
"Please report this: https://github.com/tusharsadhwani/yen/issues/new",
file=sys.stderr,
)
return 1

if args.command == "ensurepath":
ensurepath()
Expand Down
3 changes: 0 additions & 3 deletions src/yen/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ def download(url: str, display_name: str, directory: str, is_32bit: bool) -> str
"""Downloads file to the given directory. Returns path to downloaded file."""
with PROGRESS:
filename = url.split("/")[-1]
if is_32bit:
filename += SUFFIX_32BIT

filepath = os.path.join(directory, filename)
task_id = PROGRESS.add_task("download", display_name=display_name, start=False)
response = urlopen(url)
Expand Down

0 comments on commit 4fc3319

Please sign in to comment.