Skip to content

Use $XDG_CACHE_HOME by default for distshare #535

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Not released yet
----

- #346: Use $XDG_CACHE_HOME by default for distshare
- #474: Start using setuptools_scm for tag based versioning.
- #506: With `-a`: do not show additional environments header if there are none

Expand Down
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,4 @@ Paweł Adamczak
Oliver Bestwalter
Selim Belhaouane
Nick Douma
Jerome Leclanche
2 changes: 1 addition & 1 deletion doc/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ List of optional global options::
toxworkdir=path # tox working directory, defaults to {toxinidir}/.tox
setupdir=path # defaults to {toxinidir}
distdir=path # defaults to {toxworkdir}/dist
distshare=path # (DEPRECATED) defaults to {homedir}/.tox/distshare
distshare=path # (DEPRECATED) defaults to $XDG_CACHE_HOME/tox/distshare
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the docs say: this feature is deprecated, so why should we put extra work into this - or is the deprecation deprecated?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... or am I missing something?

Copy link
Author

@jleclanche jleclanche Jun 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no idea about the feature, but its default has been updated due to how the PR works. I wanted the documentation to be consistent.

envlist=ENVLIST # defaults to the list of all environments
skipsdist=BOOL # defaults to false

Expand Down
6 changes: 4 additions & 2 deletions doc/example/general.txt
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,10 @@ that another tox run can find the "latest" dependency. This feature
allows to test a package against an unreleased development version
or even an uncommitted version on your own machine.

By default, ``{homedir}/.tox/distshare`` will be used for
copying in and copying out artifacts (i.e. Python packages).
By default, the distshare directory is located in
``$XDG_CACHE_HOME/tox/distshare``, where ``$XDG_CACHE_HOME`` defaults to
``{homedir}`` if not set. This directory will be used for copying in and
Copy link

@merwok merwok Jun 30, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be {homedir}/.cache/

copying out artifacts (i.e. Python packages).

For project ``two`` to depend on the ``one`` package you use
the following entry::
Expand Down
10 changes: 8 additions & 2 deletions tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,13 @@ def test_defaults(self, tmpdir, newconfig):

def test_defaults_distshare(self, tmpdir, newconfig):
config = newconfig([], "")
assert config.distshare == config.homedir.join(".tox", "distshare")
assert config.distshare == config.homedir.join(".cache", "tox", "distshare")

def test_defaults_distshare_xdg_set(self, tmpdir, newconfig):
xdg_cache = str(tmpdir.join("tox-xdg-cache-test"))
os.environ["XDG_CACHE_HOME"] = xdg_cache
config = newconfig([], "")
assert config.distshare == os.path.join(xdg_cache, "tox", "distshare")

def test_defaults_changed_dir(self, tmpdir, newconfig):
tmpdir.mkdir("abc").chdir()
Expand Down Expand Up @@ -1060,7 +1066,7 @@ def test_substitution_defaults(tmpdir, newconfig):
assert argv[4][0] == conf.envtmpdir
assert argv[5][0] == conf.envpython
assert argv[6][0] == str(config.homedir)
assert argv[7][0] == config.homedir.join(".tox", "distshare")
assert argv[7][0] == config.distshare
assert argv[8][0] == conf.envlogdir

def test_substitution_notfound_issue246(tmpdir, newconfig):
Expand Down
3 changes: 2 additions & 1 deletion tox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,8 @@ def __init__(self, config, inipath):
distshare_default = "{toxworkdir}/distshare"
elif not ctxname:
reader = SectionReader("tox", self._cfg, prefix=prefix)
distshare_default = "{homedir}/.tox/distshare"
xdg_cache_home = os.getenv("XDG_CACHE_HOME", "{homedir}/.cache")
distshare_default = os.path.join(xdg_cache_home, "tox", "distshare")
else:
raise ValueError("invalid context")

Expand Down