Skip to content

Commit

Permalink
Merge pull request #76 from pulsepm/force-uninstall
Browse files Browse the repository at this point in the history
STDLIB Anti-Uninstal
  • Loading branch information
Mergevos authored May 14, 2024
2 parents df12ca2 + 8486013 commit efa977c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions pulse/core/core_constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
STDLIB_NAME: str = "omp-stdlib"
7 changes: 6 additions & 1 deletion pulse/package/package_uninstall.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
from pulse.core.core_dir import PACKAGE_PATH, REQUIREMENTS_PATH, PLUGINS_PATH
import pulse.package.package_utils as package_utils
import pulse.core.git.git_get as git_get
import pulse.core.core_constants as core_constants
import shutil


@click.command
@click.argument("package")
@click.option("-r", "--recursive", is_flag=True, default=False)
def uninstall(package: str, recursive: bool) -> None:
@click.option("-f", "--force", is_flag=True, default=False)
def uninstall(package: str, recursive: bool, force: bool) -> None:
"""
Uninstall pulse package.
"""
Expand Down Expand Up @@ -41,6 +43,9 @@ def uninstall(package: str, recursive: bool) -> None:
if not os.path.exists(package_path):
return click.echo(f"Package {package} was not found.")

if re_package[1] == core_constants.STDLIB_NAME and not force:
return click.echo(f"Unable to remove {core_constants.STDLIB_NAME}, use the -f (--force) flag to remove the package")

package_type = package_utils.get_local_package_type(re_package[0], re_package[1], re_package[2])
if recursive:
dependencies = git_get.get_requirements(package_path, package_type)
Expand Down

0 comments on commit efa977c

Please sign in to comment.