Why does `setup.py install` not update the script file?

In the setup.py I write like this:

 from distutils.core import setup setup( # skip a lot of information here.. scripts = ["chilin2/ChiLin2.py"], ) 

I successfully installed my package for the first time. After a while, I update line 209 script as follows:

 $ sed -n 209p chilin2/ChiLin2.py macs2_on_merged.param["control_opt"] = "-c " + macs2_on_merged.input["control"] 

And then run setup.py again

 $ sudo python3 setup.py install running install running build running build_py running build_scripts running install_lib running install_scripts changing mode of /usr/local/bin/ChiLin2.py to 755 running install_egg_info Removing /usr/local/lib/python3.2/site-packages/chilin2-0.1-py3.2.egg-info Writing /usr/local/lib/python3.2/site-packages/chilin2-0.1-py3.2.egg-info 

However, I found that the script file was not modified.

 $ sed -n 209p /usr/local/bin/ChiLin2.py macs2_on_merged["control_opt"] = "-c " + macs2_on_merged.input["control"] 

I tried setup.py clean and then setup.py install again, but this does not solve the problem. Anyone have any ideas on this?

(I found that Chilin2.py in the package has an older timestamp than in the system directory. Is this the reason why setup.py install not updated? Is there a way to solve this problem?)

+4
source share
2 answers

try uninstalling this package and then reinstalling it.

pip can remove the package:

 pip uninstall *packagename* 
+1
source

I found that Chilin2.py in the package has a higher timestamp than in the system directory.

This is strange. Can you reproduce the error using the following steps:

  • Create a script.
  • setup.py install (with the --install or --user option to avoid sudo)
  • Change script.
  • setup.py install

If you did this (i.e. you edited the script after the first installation), I donโ€™t understand how the last script can have a modification time older than the installed script.

Is there a reason why setup.py installation is not updated?

Definitely: distutils compares the file modification time to see if it needs to be rebuilt (for scripts, the build phase consists of copying the files to the temp build directory and setting up shebangs).

Is there any way to solve this problem?

 $ touch chilin2/ChiLin2.py 
+1
source

All Articles