Bug 1251464

Summary: build and install from version specific build directory
Product: [Fedora] Fedora Reporter: Thomas Spura <tomspur>
Component: pythonAssignee: Charalampos Stratakis <cstratak>
Status: CLOSED WONTFIX QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: bkabrda, dmalcolm, ivazqueznet, jberan, jonathansteffan, mhroncok, ncoghlan, pviktori, redhat-bugzilla, tomspur, tradej
Target Milestone: ---Keywords: FutureFeature
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-10-18 22:14:48 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1076441    

Description Thomas Spura 2015-08-07 11:40:14 UTC
Description of problem:

- "python setup.py build" supports --build-lib
- "python setup.py install" does NOT supports --build-lib, so the files from above cannot be installed.
- "python setup.py install_lib" DOES support --build-lib

Please add the --build-lib argument also to the general install command, so that one can build and install in a specific (version aware) directory.

Version-Release number of selected component (if applicable):
python2 and python3

How reproducible:
always

Steps to Reproduce:
1. python setup.py build --build-lib=build/lib.%{_os}-%{_target_cpu}-%{python2_version}
2. python setup.py install --build-lib=build/lib.%{_os}-%{_target_cpu}-%{python2_version}


Actual results:
python setup.py install --build-lib=build/lib.%{_os}-%{_target_cpu}-%{python2_version}
usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
   or: setup.py --help [cmd1 cmd2 ...]
   or: setup.py --help-commands
   or: setup.py cmd --help

error: option --build-dir not recognized

Expected results:
python setup.py install --build-lib=build/lib.%{_os}-%{_target_cpu}-%{python2_version}
just works


Additional info/background of problem:

python tries to detect if the package is a purelib and builds then when invoking "setup.py build" in the directory "build/lib". This works fine when building for only one python implementation but causes conflicts when building for python2 and python3 at the same time.

This can be seen when a project is calling 2to3 in the build phase. The steps that one would put into a spec file is:

1. Build with python2 # build/lib will contain python2 files
2. Build with python3 # build/lib will contain python3 files
3. Install with python2 # python3 files from build/lib are installed
4. Install with python3 # python3 files from build/lib are installed

One solution to this problem is to build with --build-lib=build/lib.%{_os}-%{_target_cpu}-%{python3_version} or the python2_version.

Comment 1 Miro HronĨok 2015-08-07 12:07:41 UTC
Should this really block bz1076441?

Comment 2 Thomas Spura 2015-08-07 12:17:09 UTC
This causes problems with the new py2_build and py3_build macros so is definitely a python2->python3 issue. Therefore, solving this will make the transition to python3 much easier.

Comment 3 Thomas Spura 2015-08-28 21:48:25 UTC
Hmm, while looking at implementing it I found this in the source code:
from Lib/distutils/command/install.py:
199         # These are only here as a conduit from the 'build' command to the      
200         # 'install_*' commands that do the real work.  ('build_base' isn't      
201         # actually used anywhere, but it might be useful in future.)  They      
202         # are not user options, because if the user told the install            
203         # command where the build directory is, that wouldn't affect the        
204         # build command.                                                        
205         self.build_base = None                                                  
206         self.build_lib = None    

So --build-lib is not an option on purpose because one must somehow trust the user to point to the correct build directory, which the author of these lines obviously doesn't.

Maybe having an option that does disable the pure python mode and does build in a version- (and arch-) specific directory by default would make more sense given the above comment?
What do you think?

Comment 4 Fedora Admin XMLRPC Client 2016-01-29 13:04:40 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 5 Jan Kurik 2016-02-24 13:35:51 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 24 development cycle.
Changing version to '24'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora24#Rawhide_Rebase

Comment 6 Fedora End Of Life 2017-07-25 19:08:03 UTC
This message is a reminder that Fedora 24 is nearing its end of life.
Approximately 2 (two) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 24. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '24'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 24 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Petr Viktorin (pviktori) 2017-10-05 14:39:41 UTC
Thomas, is this still relevant?
I don't understand the issue at first glance, and I wonder if I should make the effort to investigate.

Comment 8 Thomas Spura 2017-10-18 22:13:47 UTC
As the py?_build and py?_install macros work also now with the current status, a fix for the above is probably not needed anymore and can be further investigated, when there are problems withusing python2 and python3 installs in the same spec. Thanks