From 6f58adff3ffef015de299e24720dca3997878a71 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 13 Jul 2018 15:17:49 +0100 Subject: gitignore: Ignore .venv directory These are commonly used for testing purposes. Signed-off-by: Stephen Finucane --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index b850622f..1f58eb31 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,7 @@ setuptools.egg-info .coverage .eggs .tox +.venv *.egg *.py[cod] *.swp -- cgit v1.2.1 From cf50418d36c80b35e0f791a96f0a828705ebf25f Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 13 Jul 2018 15:20:46 +0100 Subject: trivial: Fix file permissions There's no reason these should be executable. Signed-off-by: Stephen Finucane --- setuptools/command/easy_install.py | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 setuptools/command/easy_install.py diff --git a/setuptools/command/easy_install.py b/setuptools/command/easy_install.py old mode 100755 new mode 100644 -- cgit v1.2.1 From 47874756915a9a757f81d87f32ef5bfa2a333a26 Mon Sep 17 00:00:00 2001 From: Stephen Finucane Date: Fri, 13 Jul 2018 15:59:55 +0100 Subject: egg_info: Touch 'egg-info' directory 'tox' determines whether a package should be rebuilt by comparing the timestamp of the package's 'egg-info' directory and its 'setup.py' or 'setup.cfg' files [1][2]. Unfortunately this checks the 'egg-info' directory itself, which is not updated, unlike the contents of that directory. This means that 'tox' will always rebuild the package once one of the two setup files has been updated. While this is clearly a bug in 'tox' that should be fixed separately, there is merit in using this as a heuristic so enable it. [1] https://github.com/tox-dev/tox/blob/3.1.0/src/tox/venv.py#L253-L257 [2] https://github.com/tox-dev/tox/blob/3.1.0/src/tox/venv.py#L221-L244 Signed-off-by: Stephen Finucane --- changelog.d/1427.change.rst | 1 + setuptools/command/egg_info.py | 1 + setuptools/tests/test_egg_info.py | 17 +++++++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 changelog.d/1427.change.rst diff --git a/changelog.d/1427.change.rst b/changelog.d/1427.change.rst new file mode 100644 index 00000000..86260235 --- /dev/null +++ b/changelog.d/1427.change.rst @@ -0,0 +1 @@ +Set timestamp of ``.egg-info`` directory whenever ``egg_info`` command is run. diff --git a/setuptools/command/egg_info.py b/setuptools/command/egg_info.py index 5fd6c888..a3cd35dc 100644 --- a/setuptools/command/egg_info.py +++ b/setuptools/command/egg_info.py @@ -281,6 +281,7 @@ class egg_info(InfoCommon, Command): def run(self): self.mkpath(self.egg_info) + os.utime(self.egg_info, None) installer = self.distribution.fetch_build_egg for ep in iter_entry_points('egg_info.writers'): ep.require(installer=installer) diff --git a/setuptools/tests/test_egg_info.py b/setuptools/tests/test_egg_info.py index 1a100266..c7a08295 100644 --- a/setuptools/tests/test_egg_info.py +++ b/setuptools/tests/test_egg_info.py @@ -1,9 +1,11 @@ +import datetime import sys import ast import os import glob import re import stat +import time from setuptools.command.egg_info import egg_info, manifest_maker from setuptools.dist import Distribution @@ -146,6 +148,21 @@ class TestEggInfo: ] assert sorted(actual) == expected + def test_rebuilt(self, tmpdir_cwd, env): + """Ensure timestamps are updated when the command is re-run.""" + self._create_project() + + self._run_egg_info_command(tmpdir_cwd, env) + timestamp_a = os.path.getmtime('foo.egg-info') + + # arbitrary sleep just to handle *really* fast systems + time.sleep(.001) + + self._run_egg_info_command(tmpdir_cwd, env) + timestamp_b = os.path.getmtime('foo.egg-info') + + assert timestamp_a != timestamp_b + def test_manifest_template_is_read(self, tmpdir_cwd, env): self._create_project() build_files({ -- cgit v1.2.1