2021-05-25 01:24:06 +00:00
|
|
|
import os
|
|
|
|
import shutil
|
- Replaced pipenv with poetry
- Updated min version check in setup.py to Python 3.6
- Updated isort config file and calls to align with v5.x
- Added init-hook for gi imports in .pylintrc to avoid invalid no-member issues
- Makefile: added lock, show-tree, bandit, black, mypy; updated test, cover, dev, isort, autopep8, check, isort-check, flake8, pylint; removed req, requirements;
- Updated .travis.yml to use poetry and make
- Added my email in AUTHORS
- Updated CONTRIBUTING.md
- Updated lint_python.yml to use poetry and make, reorganized instructions to have all install related steps first
- sorted imports: lutris, lutris-wrapper, cleanup_prefix.py and multiple files in tests dir
2021-10-24 18:42:06 +00:00
|
|
|
import sys
|
2021-05-25 01:24:06 +00:00
|
|
|
|
|
|
|
KNOWN_DIRS = [
|
|
|
|
"ProgramData/Microsoft/Windows",
|
|
|
|
"Program Files/Common Files/Microsoft Shared",
|
|
|
|
"Program Files/Common Files/System",
|
|
|
|
"Program Files/Internet Explorer",
|
|
|
|
"Program Files/Windows Media Player",
|
|
|
|
"Program Files/Windows NT",
|
|
|
|
"windows",
|
|
|
|
]
|
|
|
|
|
2021-08-02 14:49:31 +00:00
|
|
|
|
2021-05-25 01:24:06 +00:00
|
|
|
def delete_known_dirs(prefix_path):
|
|
|
|
for known_dir in KNOWN_DIRS:
|
|
|
|
full_path = os.path.join(prefix_path, "drive_c", known_dir)
|
|
|
|
if not os.path.exists(full_path):
|
|
|
|
continue
|
|
|
|
print("Deleting %s", full_path)
|
|
|
|
shutil.rmtree(full_path)
|
|
|
|
|
|
|
|
|
|
|
|
def remove_empty_dirs(dirname):
|
|
|
|
empty_folders = []
|
|
|
|
for root, dirs, files in os.walk(dirname, topdown=True):
|
|
|
|
print(root, files, dirs)
|
|
|
|
if not files and not dirs:
|
|
|
|
empty_folders.append(root)
|
|
|
|
for folder in empty_folders:
|
|
|
|
os.rmdir(folder)
|
|
|
|
return empty_folders
|
|
|
|
|
2021-08-02 14:49:31 +00:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
dirname = sys.argv[1]
|
|
|
|
delete_known_dirs(dirname)
|
|
|
|
empty_folders = True
|
|
|
|
while empty_folders:
|
|
|
|
empty_folders = remove_empty_dirs(dirname)
|