classification
Title: setup.py install doesn't parse spaces in path
Type: enhancement Stage: resolved
Components: Distutils Versions: Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: distutils compiler not handling spaces in path to output/src files
View: 4508
Assigned To: Nosy List: drunax, ned.deily
Priority: normal Keywords:

Created on 2014-03-02 13:01 by drunax, last changed 2014-03-02 20:07 by ned.deily. This issue is now closed.

Messages (3)
msg212548 - (view) Author: Alexandru Gheorghe (drunax) Date: 2014-03-02 13:01
When having spaces in the path which represents the root for the build on going, rpmbuild from bdist_rpm will fail:


----------------------------------------------------
+ python setup.py install -O1 --root=/home/lex/Development/4. Test/11. ARTA/build/src/rpm/BUILDROOT/efw-arta-3.0.1_0.test0-0.x86_64 --record=INSTALLED_FILES
invalid command name 'Test/11.'
error: Bad exit status from /var/tmp/rpm-tmp.cbEEZl (%install)


RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.cbEEZl (%install)
error: command 'rpmbuild' failed with exit status 1
----------------------------------------------------

With this patch it will work:

--- bdist_rpm-BAK.py	2014-03-02 14:52:31.501744617 +0200
+++ bdist_rpm.py	2014-03-02 14:53:10.705746243 +0200
@@ -512,8 +512,8 @@
         # that we open and interpolate into the spec file, but the defaults
         # are just text that we drop in as-is.  Hmmm.
 
-        install_cmd = ('%s install -O1 --root=$RPM_BUILD_ROOT '
-                       '--record=INSTALLED_FILES') % def_setup_call
+        install_cmd = ('%s install -O1 --root="$RPM_BUILD_ROOT" '
+                       '--record="INSTALLED_FILES"') % def_setup_call
 
         script_options = [
             ('prep', 'prep_script', "%setup -n %{name}-%{unmangled_version}"),


but then another roadblock is hit:


+ cp -pr CHANGELOG /home/lex/Development/4. Test/11. ARTA/build/src/rpm/BUILDROOT/efw-safi-3.0.1_0.test0-0.x86_64/usr/share/doc/efw-arta-3.0.1_0.test0
cp: cannot stat `CHANGELOG': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.1tO2OV (%doc)
error: File not found: /home/lex/Development/4. Test/11. ARTA/build/src/rpm/BUILDROOT/efw-arta-3.0.1_0.test0-0.x86_64/usr/share/doc/efw-arta-3.0.1_0.test0


seems stat also needs quoted path:

lex@hemvi:~/Development/4. Test/11. ARTA/build$ stat --format="%a" /home/lex/Development/4. Test/11. ARTA/build/CHANGELOG ; echo $?
755
stat: cannot stat `Test/11.': No such file or directory
stat: cannot stat `ARTA/build/CHANGELOG': No such file or directory
1

lex@hemvi:~/Development/4. Test/11. ARTA/build$ stat --format="%a" "/home/lex/Development/4. Test/11. ARTA/build/CHANGELOG" ; echo $?
644
0


I guess all the calls need to be rewritten to take into account spaces in the path. This would be too laborious, thus perhaps we should warn in documentation packagers/developers not to use spaces in path when building?
msg212549 - (view) Author: Alexandru Gheorghe (drunax) Date: 2014-03-02 13:04
Hmm, sorry, this seems to be a duplicate of issue4508 [ http://bugs.python.org/issue4508 ]

Should we close this as duplicate or keep it for further reference?
msg212587 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2014-03-02 20:07
Thanks for noticing the duplicate.  I suggest adding yourself to the nosy list of Issue4508 and commenting there if you'd like to help things along.
History
Date User Action Args
2014-03-02 20:07:18ned.deilysetstatus: open -> closed

superseder: distutils compiler not handling spaces in path to output/src files

nosy: + ned.deily
messages: + msg212587
resolution: duplicate
stage: resolved
2014-03-02 13:04:16drunaxsetmessages: + msg212549
2014-03-02 13:01:16drunaxcreate