Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
beec7ff9
Commit
beec7ff9
authored
Aug 27, 2016
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rely on appdirs for resolving a cache dir for Python-Eggs. Fixes #763.
parent
691e6ac0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
41 deletions
+17
-41
CHANGES.rst
CHANGES.rst
+8
-0
pkg_resources/__init__.py
pkg_resources/__init__.py
+9
-41
No files found.
CHANGES.rst
View file @
beec7ff9
...
...
@@ -2,6 +2,14 @@
CHANGES
=======
v26
.1.0
-------
*
#
763
:
``
pkg_resources
.
get_default_cache
``
now
defers
to
the
`
appdirs
project
<
https
://
pypi
.
org
/
project
/
appdirs
>`
_
to
resolve
the
cache
directory
.
Adds
a
vendored
dependency
on
appdirs
to
pkg_resources
.
v26
.0.0
-------
...
...
pkg_resources/__init__.py
View file @
beec7ff9
...
...
@@ -65,6 +65,7 @@ try:
except
ImportError
:
importlib_machinery
=
None
from
pkg_resources.extern
import
appdirs
from
pkg_resources.extern
import
packaging
__import__
(
'pkg_resources.extern.packaging.version'
)
__import__
(
'pkg_resources.extern.packaging.specifiers'
)
...
...
@@ -1358,48 +1359,15 @@ class ResourceManager:
def get_default_cache():
"""
Determine
the
default
cache
location
This
returns
the
``
PYTHON_EGG_CACHE
``
environment
variable
,
if
set
.
Otherwise
,
on
Windows
,
it
returns
a
"Python-Eggs"
subdirectory
of
the
"Application Data"
directory
.
On
all
other
systems
,
it
's "~/.python-eggs".
"""
try:
return os.environ['
PYTHON_EGG_CACHE
']
except KeyError:
pass
if os.name != '
nt
':
return os.path.expanduser('
~/
.
python
-
eggs
')
# XXX this may be locale-specific!
app_data = '
Application
Data
'
app_homes = [
# best option, should be locale-safe
(('
APPDATA
',), None),
(('
USERPROFILE
',), app_data),
(('
HOMEDRIVE
', '
HOMEPATH
'), app_data),
(('
HOMEPATH
',), app_data),
(('
HOME
',), None),
# 95/98/ME
(('
WINDIR
',), app_data),
]
for keys, subdir in app_homes:
dirname = ''
for key in keys:
if key in os.environ:
dirname = os.path.join(dirname, os.environ[key])
else:
break
else:
if subdir:
dirname = os.path.join(dirname, subdir)
return os.path.join(dirname, '
Python
-
Eggs
')
else:
raise RuntimeError(
"Please set the PYTHON_EGG_CACHE environment variable"
)
Return
the
``
PYTHON_EGG_CACHE
``
environment
variable
or
a
platform
-
relevant
user
cache
dir
for
an
app
named
"Python-Eggs"
.
"""
return (
os.environ.get('PYTHON_EGG_CACHE')
or appdirs.user_cache_dir(appname='Python-Eggs')
)
def safe_name(name):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment