Skip to content

Commit

Permalink
Corrected mistakes with refactor and the categories that aren't default
Browse files Browse the repository at this point in the history
  • Loading branch information
matteius committed Oct 25, 2024
1 parent 8823167 commit 84ee856
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pipenv/cli/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ def install(state, **kwargs):
editable_packages=state.installstate.editables,
site_packages=state.site_packages,
extra_pip_args=state.installstate.extra_pip_args,
categories=state.installstate.categories,
pipfile_categories=state.installstate.categories,
skip_lock=state.installstate.skip_lock,
)

Expand Down
20 changes: 10 additions & 10 deletions pipenv/routines/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def do_install(
deploy=False,
site_packages=None,
extra_pip_args=None,
categories=None,
pipfile_categories=None,
skip_lock=False,
):
requirements_directory = fileutils.create_tracked_tempdir(
Expand All @@ -263,10 +263,10 @@ def do_install(
editable_packages = editable_packages if editable_packages else []
package_args = [p for p in packages if p] + [p for p in editable_packages if p]
new_packages = []
if dev and not categories:
categories = ["packages", "dev-packages"]
elif not categories:
categories = ["packages"]
if dev and not pipfile_categories:
pipfile_categories = ["packages", "dev-packages"]
elif not pipfile_categories:
pipfile_categories = ["packages"]

ensure_project(
project,
Expand All @@ -277,7 +277,7 @@ def do_install(
skip_requirements=False,
pypi_mirror=pypi_mirror,
site_packages=site_packages,
categories=categories,
pipfile_categories=pipfile_categories,
)

do_install_validations(
Expand All @@ -290,7 +290,7 @@ def do_install(
requirementstxt=requirementstxt,
pre=pre,
deploy=deploy,
categories=categories,
categories=pipfile_categories,
skip_lock=skip_lock,
)

Expand All @@ -313,11 +313,11 @@ def do_install(
system=system,
pypi_mirror=pypi_mirror,
extra_pip_args=extra_pip_args,
categories=categories,
categories=pipfile_categories,
perform_upgrades=not skip_lock,
index=index,
)
if not dev and len(categories) == 1 and packages_installed:
if not dev and len(pipfile_categories) == 1 and packages_installed:
sys.exit(0)

try:
Expand All @@ -328,7 +328,7 @@ def do_install(
requirements_dir=requirements_directory,
pypi_mirror=pypi_mirror,
extra_pip_args=extra_pip_args,
categories=categories,
categories=pipfile_categories,
skip_lock=skip_lock,
)
except Exception as e:
Expand Down
6 changes: 6 additions & 0 deletions pipenv/routines/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,12 @@ def upgrade(
categories = ["develop"]
else:
categories = ["default"]
elif "dev-packages" in categories:
categories.remove("dev-packages")
categories.insert(0, "develop")
elif "packages" in categories:
categories.remove("packages")
categories.insert(0, "default")

# Get current dependency graph
try:
Expand Down
4 changes: 2 additions & 2 deletions pipenv/utils/pipfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def find_pipfile(max_depth=3):


def ensure_pipfile(
project, validate=True, skip_requirements=False, system=False, categories=None
project, validate=True, skip_requirements=False, system=False, pipfile_categories=None
):
"""Creates a Pipfile for the project, if it doesn't exist."""

Expand Down Expand Up @@ -96,7 +96,7 @@ def ensure_pipfile(
) as st:
# Import requirements.txt.
try:
import_requirements(project, categories=categories)
import_requirements(project, categories=pipfile_categories)
except Exception:
err.print(environments.PIPENV_SPINNER_FAIL_TEXT.format("Failed..."))
else:
Expand Down
4 changes: 2 additions & 2 deletions pipenv/utils/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def ensure_project(
skip_requirements=False,
pypi_mirror=None,
clear=False,
categories=None,
pipfile_categories=None,
):
"""Ensures both Pipfile and virtualenv exist for the project."""

Expand Down Expand Up @@ -91,7 +91,7 @@ def ensure_project(
validate=validate,
skip_requirements=skip_requirements,
system=system,
categories=categories,
pipfile_categories=pipfile_categories,
)
os.environ["PIP_PYTHON_PATH"] = project.python(system=system)

Expand Down

0 comments on commit 84ee856

Please sign in to comment.