[issue13420] newer() function in dep_util.py discard changes in the same second

David Amian report at bugs.python.org
Mon Nov 21 17:29:55 CET 2011


David Amian <damian at emergya.com> added the comment:

2011/11/18 Éric Araujo <report at bugs.python.org>

>
> Éric Araujo <merwok at netwok.org> added the comment:
>
> > I've a project, in the setup.py file, I've a function called
> update_prefix, that updates the
> > 'path_project' variable with prefix arguments from setup.py
> > If you runs setup.py with --prefix=/usr, then the file in
> 'projectname/projectnameconfig.py' is
> > modified changing the 'path_project' variable from @PREFIX at +"share/projectname"
> to
> > '/usr/share/projectname'. If you runs setup.py without prefix arguments,
> the prefix is '/usr/local'.
>
> Did you write a custom 'install' class or are you for example looking at
> sys.argv to decide whether to run your function?  If it’s not implemented
> as a distutils command, it’s not surprising that it does not integrate well.
>

Really I've a function to update prefix based on sys.argv but i changed
this using a custom class command and the same issue occurs

>
> > [...]
> > That is cause of the issue, that I explain in the early comment, I fixed
> it rounding to two decimals
> > instead of rounding to integer.
>
> Okay.  Can you make sure that this is the source of the problem, for
> example by adding time.sleep(1) between build and install?
>

I puts a time.sleep(1) bewteen 'setup.py build' and 'setup.py install' and
I got these results:

*Without waiting:

$debuild -us -uc
[...]
mkdir -p debian/python-module-stampdir
cd . && \
python setup.py build \
--build-base="/tmp/pdal/pdal2-0.3.1/./build"
running build
running build_py
copying pdal/pdalconfig.py -> build/lib.linux-i686-2.7/pdal
running build_scripts
[...]
python setup.py install \
--root="/tmp/pdal/pdal2-0.3.1/debian/pdal2/" \
--install-purelib=/usr/lib/python2.7/site-packages/ \
-f --prefix=/usr
[...]
running build
running build_py
running build_scripts
[...]

$

The stats of files are:

File: «pdal/pdalconfig.py»
Modify: 2011-11-21 13:44:52.497971724 +0100

File: «build/lib.linux-i686-2.7/pdal/pdalconfig.py»
Modify: 2011-11-21 13:44:52.000000000 +0100

It doesn't copy in the install step because st_mtimes in newer() are the
same:
ST_MTIME-source- 1321879492
ST_MTIME-target- 1321879492

*Waiting a second between build and install:

$debuild -us -uc
[...]
mkdir -p debian/python-module-stampdir
cd . && \
python setup.py build \
--build-base="/tmp/pdal/pdal2-0.3.1/./build"
running build
running build_py
copying pdal/pdalconfig.py -> build/lib.linux-i686-2.7/pdal
running build_scripts
[...]
python setup.py install \
--root="/tmp/pdal/pdal2-0.3.1/debian/pdal2/" \
--install-purelib=/usr/lib/python2.7/site-packages/ \
-f --prefix=/usr
[...]
running build
running build_py
copying pdal/pdalconfig.py -> build/lib.linux-i686-2.7/pdal
running build_scripts
[...]

$

Obviously the file has been copied as st_mtimes in newer() differ by a
second
ST_MTIME-source- 1321879603
ST_MTIME-target- 1321879602

>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue13420>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13420>
_______________________________________


More information about the Python-bugs-list mailing list