Example #1
0
def _strip_pii(s: str):
    s = s.replace(variables.home(), "~")

    if getpass.getuser().lower() != "root":
        s = s.replace(getpass.getuser(), "[REDACTED]")

    return s
    def __init__(self, build_dir, dist_dir, level_1_directory: str = ".local"):
        configuration = LinuxPackageConfiguration(build_dir)
        configuration.python_site_type = "site-packages"
        configuration.python_site_version = f"python{sys.version_info.major}.{sys.version_info.minor}"
        configuration.copy_packages = False
        configuration.level_1_directory = level_1_directory
        configuration.target_system_root = v.home()

        super().__init__(build_dir, dist_dir, configuration)
Example #3
0
def go(parameters: UninstallationParameters):
    assert parameters and isinstance(
        parameters,
        UninstallationParameters), "Programmer error: Invalid params argument"

    LOG.info("Uninstalling Grapejuice, parameters: " +
             json.dumps(asdict(parameters), indent=2))

    LOG.info(
        subprocess.check_output([sys.executable, "-m", "grapejuiced",
                                 "kill"]).decode("UTF-8"))

    with open(variables.application_manifest(), "r") as fp:
        manifest = json.load(fp)

    for file in manifest["files"]:
        if not os.path.isabs(file):
            o_file = file
            file = os.path.join(variables.home(), file)
            LOG.info(f"Mended file path: {o_file} -> {file}")

        if os.path.exists(file) and os.path.isfile(file):
            LOG.info(f"Removing file from manifest: {file}")

            if parameters.for_reals:
                os.remove(file)

    if parameters.remove_prefix:
        LOG.info(
            f"Removing full user application directory: {variables.user_application_dir()}"
        )

        if parameters.for_reals:
            shutil.rmtree(variables.user_application_dir(), ignore_errors=True)

    else:
        LOG.info(f"Removing manifest: {variables.application_manifest()}")

        if parameters.for_reals:
            os.remove(variables.application_manifest())

    LOG.info(
        subprocess.check_output(
            [sys.executable, "-m", "pip", "uninstall", "-y",
             "grapejuice"]).decode("UTF-8"))

    sys.exit(0)
Example #4
0
    def update_desktop_database(log):
        path = Path(v.home(), ".local", "share", "applications").absolute()
        log.info(f"Updating desktop database: {path}")

        subprocess.check_call(["update-desktop-database", str(path)])
Example #5
0
    def install_supplemental_packages(log):
        for file in Path("dist", "supplemental_package").glob("*.tar.gz"):
            log.info(f"Installing supplemental package {file}")

            with tarfile.open(file) as tar:
                tar.extractall(v.home())
Example #6
0
    def update_mime_database(log):
        path = Path(v.home(), ".local", "share", "mime").absolute()
        log.info(f"Updating MIME database: {path}")

        subprocess.check_call(["update-mime-database", str(path)])