Skip to content

Commit

Permalink
Raise an error when pip not supportschoosing platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
ozobotnovako committed Apr 9, 2024
1 parent d954a87 commit 1fc6e07
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion pip2nix/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
import re
import shutil

from pip._internal.models.target_python import TargetPython
try:
from pip._internal.models.target_python import TargetPython
except ImportError:
TargetPython = None

try:
from pip._internal.cli import cmdoptions
Expand Down Expand Up @@ -200,6 +203,10 @@ def super_run(self, options, args):

with self._build_session(options) as session:
platform = self.config.get_config("pip2nix", "platform")

if platform and not TargetPython:
raise ValueError("Target platform specified, but pip is too old to support it.")

target_python = TargetPython(platform)
finder = self._build_package_finder(options, session, target_python)
wheel_cache = WheelCache(options.cache_dir, options.format_control)
Expand Down

0 comments on commit 1fc6e07

Please sign in to comment.