[issue31551] test_distutils fails if current directory contains spaces

2021-02-03 Thread Steve Dower


Steve Dower  added the comment:

Distutils is now deprecated (see PEP 632) and all tagged issues are being 
closed. From now until removal, only release blocking issues will be considered 
for distutils.

If this issue does not relate to distutils, please remove the component and 
reopen it. If you believe it still requires a fix, most likely the issue should 
be re-reported at https://github.com/pypa/setuptools

--
nosy: +steve.dower
resolution:  -> out of date
stage:  -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31551] test_distutils fails if current directory contains spaces

2018-09-26 Thread Karthikeyan Singaravelan


Karthikeyan Singaravelan  added the comment:

There is a similar issue with whitespace in filenames causing failure in 
bdist_rpm tracked at issue809163. It has test cases but unfortunately the issue 
didn't move forward and has only patches. I tried the patches but none of them 
seem to fix the issue here. The issue seems to be in spec file generation with 
space in path of python executable. Did some debugging and my analysis as 
follows. Renamed my source directory 'cpython' as 'cpy thon' and made a clean 
build. It seems that sys.executable returns '/home/karthi/cpy thon/python' 
which is used as the python binary for the commands and hence with normal 
string concatenation the spec file generated [0] . I tried very basic fix of 
sys.executable.replace(' ', '\ ') to be used as a path. It generates the 
correct spec file [1] which passes and ./python -m test -vuall test_distutils 
also passes.

I am not sure if Python has a function to escape spaces for shell commands 
which would be more reliable. I tried shlex.quote but it handles only ' and ". 
I think having space in the directory might cause issues in places where we use 
string concatenation with sys.executable without taking spaces into account 
like the other issue with windows. I will try running the test suite sometime 
with space.

[0] With spaces. The commands that fail are /home/karthi/cpy thon/python 
setup.py build and /home/karthi/cpy thon/python setup.py install -O1 
--root=$RPM_BUILD_ROOT --record=INSTALLED_FILES

%define name foo
%define version 0.1
%define unmangled_version 0.1
%define release 1

Summary: UNKNOWN
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
License: UNKNOWN
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: xxx 
Url: xxx

%description
UNKNOWN

%prep
%setup -n %{name}-%{unmangled_version}

%build
/home/karthi/cpy thon/python setup.py build

%install
/home/karthi/cpy thon/python setup.py install -O1 --root=$RPM_BUILD_ROOT 
--record=INSTALLED_FILES

%clean
rm -rf $RPM_BUILD_ROOT

%files -f INSTALLED_FILES
%defattr(-,root,root)


[1] sys.executable.replace(' ', '\ ') and the tests pass


%define name foo
%define version 0.1
%define unmangled_version 0.1
%define release 1

Summary: UNKNOWN
Name: %{name}
Version: %{version}
Release: %{release}
Source0: %{name}-%{unmangled_version}.tar.gz
License: UNKNOWN
Group: Development/Libraries
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}
BuildArch: noarch
Vendor: xxx 
Url: xxx

%description
UNKNOWN

%prep
%setup -n %{name}-%{unmangled_version}

%build
/home/karthi/cpy\ thon/python setup.py build

%install
/home/karthi/cpy\ thon/python setup.py install -O1 --root=$RPM_BUILD_ROOT 
--record=INSTALLED_FILES

%clean
rm -rf $RPM_BUILD_ROOT

%files -f INSTALLED_FILES
%defattr(-,root,root)


I am adding 3.8 also as a target as part of triaging this issue.

Thanks

--
versions: +Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31551] test_distutils fails if current directory contains spaces

2018-09-26 Thread Karthikeyan Singaravelan


Change by Karthikeyan Singaravelan :


--
nosy: +xtreak

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue31551] test_distutils fails if current directory contains spaces

2017-09-22 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Running tests from the directory containing a space: '/home/serhiy/py/cpy thon'.

$ ./python -m test -vuall test_distutils
== CPython 3.7.0a1+ (heads/master:5e02c7826f, Sep 22 2017, 13:23:33) [GCC 6.3.0 
20170406]
== Linux-4.10.0-35-generic-x86_64-with-debian-stretch-sid little-endian
== cwd: /home/serhiy/py/cpy thon/build/test_python_11135
== CPU count: 8
== encodings: locale=UTF-8, FS=utf-8
Run tests sequentially
0:00:00 load avg: 0.09 [1/1] test_distutils
test_no_optimize_flag (distutils.tests.test_bdist_rpm.BuildRpmTestCase) ... 
/var/tmp/rpm-tmp.ufRiE4: 28: /var/tmp/rpm-tmp.ufRiE4: /home/serhiy/py/cpy: not 
found
error: Bad exit status from /var/tmp/rpm-tmp.ufRiE4 (%build)
Bad exit status from /var/tmp/rpm-tmp.ufRiE4 (%build)
ERROR
test_quiet (distutils.tests.test_bdist_rpm.BuildRpmTestCase) ... 
/var/tmp/rpm-tmp.uBva85: 28: /var/tmp/rpm-tmp.uBva85: /home/serhiy/py/cpy: not 
found
error: Bad exit status from /var/tmp/rpm-tmp.uBva85 (%build)
Bad exit status from /var/tmp/rpm-tmp.uBva85 (%build)
ERROR
...
==
ERROR: test_no_optimize_flag (distutils.tests.test_bdist_rpm.BuildRpmTestCase)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpy thon/Lib/distutils/tests/test_bdist_rpm.py", line 
120, in test_no_optimize_flag
cmd.run()
  File "/home/serhiy/py/cpy thon/Lib/distutils/command/bdist_rpm.py", line 366, 
in run
self.spawn(rpm_cmd)
  File "/home/serhiy/py/cpy thon/Lib/distutils/cmd.py", line 365, in spawn
spawn(cmd, search_path, dry_run=self.dry_run)
  File "/home/serhiy/py/cpy thon/Lib/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/serhiy/py/cpy thon/Lib/distutils/spawn.py", line 159, in 
_spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'rpmbuild' failed with exit status 
1

==
ERROR: test_quiet (distutils.tests.test_bdist_rpm.BuildRpmTestCase)
--
Traceback (most recent call last):
  File "/home/serhiy/py/cpy thon/Lib/distutils/tests/test_bdist_rpm.py", line 
77, in test_quiet
cmd.run()
  File "/home/serhiy/py/cpy thon/Lib/distutils/command/bdist_rpm.py", line 366, 
in run
self.spawn(rpm_cmd)
  File "/home/serhiy/py/cpy thon/Lib/distutils/cmd.py", line 365, in spawn
spawn(cmd, search_path, dry_run=self.dry_run)
  File "/home/serhiy/py/cpy thon/Lib/distutils/spawn.py", line 36, in spawn
_spawn_posix(cmd, search_path, dry_run=dry_run)
  File "/home/serhiy/py/cpy thon/Lib/distutils/spawn.py", line 159, in 
_spawn_posix
% (cmd, exit_status))
distutils.errors.DistutilsExecError: command 'rpmbuild' failed with exit status 
1

--

See also issue31548.

--
components: Distutils, Tests
messages: 302741
nosy: dstufft, merwok, serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_distutils fails if current directory contains spaces
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com