This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pysetup install creates .pyc files but pysetup remove doesn't delete them
Type: behavior Stage: resolved
Components: Distutils2 Versions: Python 3.3
process
Status: closed Resolution: duplicate
Dependencies: Superseder: distutils doesn't byte-compile .py files to __pycache__ during installation
View: 11254
Assigned To: tarek Nosy List: alexis, eric.araujo, paul.moore, tarek
Priority: low Keywords:

Created on 2011-10-14 18:11 by paul.moore, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg145554 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-14 18:11
The title explains. Here is an example:

PS D:\Data\python-sample\python> pysetup install
Installing from source directory: 'D:\\Data\\python-sample\\python'
running install_dist
running build
running build_py
running install_lib
byte-compiling D:\Data\cpython\Lib\site-packages\hello.py to hello.cpython-33.pyc
running install_distinfo
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\METADATA
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\INSTALLER
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\REQUESTED
creating D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\RECORD
PS D:\Data\python-sample\python> pysetup remove hello
Removing 'hello':
  D:\Data\cpython\Lib\site-packages\hello.py
  D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\METADATA
  D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\INSTALLER
  D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\REQUESTED
  D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\RECORD
Proceed (y/n)? y
Success: removed 5 files and 1 dirs
PS D:\Data\python-sample> dir D:\Data\cpython\Lib\site-packages\__pycache__


    Directory: D:\Data\cpython\Lib\site-packages\__pycache__


Mode                LastWriteTime     Length Name
----                -------------     ------ ----
-a---        14/10/2011     18:53        314 hello.cpython-33.pyc

The pyc file should have been removed. It's not critical (the pyc file gets ignored, see PEP 3147) but as pysetup created it, pysetup should remove it...
msg145684 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-17 12:48
That’s odd.  Are the pyc files in RECORD?
msg145731 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-17 17:13
> That’s odd.  Are the pyc files in RECORD?

Yes, but not in __pycache__ where they should be.

PS D:\Data\python-sample\python> type
D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\RECORD
D:\Data\cpython\Lib\site-packages\hello.py,798c341fba13dcecba260e25d2b976b6,42
D:\Data\cpython\Lib\site-packages\hello.pyc,,
D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\METADATA,bcae83fd032d0c33cea5dc14a1ca1bc5,206
D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\INSTALLER,44e3fde05f3f537ed85831969acf396d,9
D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\REQUESTED,d41d8cd98f00b204e9800998ecf8427e,0
D:\Data\cpython\Lib\site-packages\hello-0.1.dist-info\RECORD,,
msg145944 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-19 19:39
I think this is #11254, for which I’ve just pushed a fix.  Can you update your 3.3 clone and try to reproduce?
msg145972 - (view) Author: Paul Moore (paul.moore) * (Python committer) Date: 2011-10-19 21:40
Yes, working correctly now
msg146079 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-10-21 13:27
\o/
History
Date User Action Args
2022-04-11 14:57:22adminsetgithub: 57390
2011-10-21 13:27:14eric.araujosetstatus: open -> closed
resolution: duplicate
messages: + msg146079

superseder: distutils doesn't byte-compile .py files to __pycache__ during installation
stage: resolved
2011-10-19 21:40:40paul.mooresetmessages: + msg145972
2011-10-19 19:39:12eric.araujosetmessages: + msg145944
2011-10-17 17:13:48paul.mooresetmessages: + msg145731
2011-10-17 12:48:25eric.araujosetmessages: + msg145684
2011-10-14 18:11:06paul.moorecreate