Python pip.utils.appdirs.user_cache_dir() Examples
The following are 2
code examples of pip.utils.appdirs.user_cache_dir().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pip.utils.appdirs
, or try the search function
.
Example #1
Source File: setup.py From magnitude with MIT License | 5 votes |
def delete_pip_files(): """Delete random pip files""" try: from pip.utils.appdirs import user_cache_dir except BaseException: try: from pip._internal.utils.appdirs import user_cache_dir except BaseException: return for root, dirnames, filenames in os.walk(user_cache_dir('pip/wheels')): for filename in fnmatch.filter(filenames, PACKAGE_NAME + '-*.whl'): try: whl = os.path.join(root, filename) print("Deleting...", whl) os.remove(whl) except BaseException: pass try: import site if hasattr(site, 'getsitepackages'): site_packages = site.getsitepackages() else: from distutils.sysconfig import get_python_lib site_packages = [get_python_lib()] if hasattr(site, 'getusersitepackages'): site_packages = site_packages + [site.getusersitepackages()] for sitepack in site_packages: for globbed in glob(sitepack + '/' + PACKAGE_NAME + '*/'): try: if globbed.endswith('.dist-info/'): shutil.rmtree(globbed) except BaseException: pass except BaseException: pass
Example #2
Source File: setup.py From supersqlite with MIT License | 5 votes |
def delete_pip_files(): """Delete random pip files""" try: from pip.utils.appdirs import user_cache_dir except BaseException: try: from pip._internal.utils.appdirs import user_cache_dir except BaseException: return for root, dirnames, filenames in os.walk(user_cache_dir('pip/wheels')): for filename in fnmatch.filter(filenames, PACKAGE_NAME + '-*.whl'): try: whl = os.path.join(root, filename) print("Deleting...", whl) os.remove(whl) except BaseException: pass try: site_packages = get_site_packages() for site_pack in site_packages: for globbed in glob(site_pack + '/' + PACKAGE_NAME + '*/'): try: if globbed.endswith('.dist-info/'): shutil.rmtree(globbed) except BaseException: pass except BaseException: pass