#32 Build fails against setuptools 40.7.0+
Closed: Invalid 3 years ago by bignose. Opened 5 years ago by slev.

Attempting to build daemon-2.2.3 I get an error:

+ /usr/bin/python setup.py build                                                
Traceback (most recent call last):                                              
  File "setup.py", line 102, in <module>                                        
    setup(**setup_kwargs)                                                       
  File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 144, in setup
    _install_setup_requires(attrs)                                              
  File "/usr/lib/python2.7/site-packages/setuptools/__init__.py", line 137, in _install_setup_requires
    dist.parse_config_files(ignore_option_errors=True)                          
  File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 703, in parse_config_files
    self._parse_config_files(filenames=filenames)                               
  File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 600, in _parse_config_files
    (parser.read_file if six.PY3 else parser.readfp)(reader)                    
  File "/usr/lib64/python2.7/ConfigParser.py", line 324, in readfp              
    self._read(fp, filename)                                                    
  File "/usr/lib64/python2.7/ConfigParser.py", line 479, in _read               
    line = fp.readline()                                                        
  File "/usr/lib64/python2.7/encodings/ascii.py", line 26, in decode            
    return codecs.ascii_decode(input, self.errors)[0]                           
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 167: ordinal not in range(128)

I see that you're using Python 2. I am unable to reproduce the behaviour:

$ python2 --version
Python 2.7.15+

$ python2 -c 'import setuptools; print(setuptools.__version__)'
40.2.0

$ python2 -m setup build
running build
running build_py
running write_version_info
writing version info to python_daemon.egg-info/version_info.json

Can you attempt to reproduce that session, to see whether there are other version differences?

Metadata Update from @bignose:
- Issue tagged with: more-info

5 years ago

Hello, as I mentioned it's reproducible with setuptools 40.7.0+ (https://pagure.io/python-daemon/pull-request/33).

python2 -c 'import setuptools; print(setuptools.__version__)'
40.8.0

Yes, the problem is only for Python2.

python3 setup.py build
(Pdb) bt
  /usr/src/RPM/BUILD/python-module-daemon-2.2.3/setup.py(102)<module>()
-> setup(**setup_kwargs)
  /usr/lib/python3/site-packages/setuptools/__init__.py(144)setup()
-> _install_setup_requires(attrs)
  /usr/lib/python3/site-packages/setuptools/__init__.py(137)_install_setup_requires()
-> dist.parse_config_files(ignore_option_errors=True)
  /usr/lib/python3/site-packages/setuptools/dist.py(704)parse_config_files()
-> self._parse_config_files(filenames=filenames)
  /usr/lib/python3/site-packages/setuptools/dist.py(601)_parse_config_files()
-> (parser.read_file if six.PY3 else parser.readfp)(reader)
> /usr/lib64/python3.6/configparser.py(705)read_file()
-> def read_file(self, f, source=None):
(Pdb) f
<_io.TextIOWrapper name='setup.cfg' encoding='UTF-8'>

python setup.py build
(Pdb) bt
  /usr/src/RPM/BUILD/python-module-daemon-2.2.3/setup.py(102)<module>()
-> setup(**setup_kwargs)
  /usr/lib/python2.7/site-packages/setuptools/__init__.py(144)setup()
-> _install_setup_requires(attrs)
  /usr/lib/python2.7/site-packages/setuptools/__init__.py(137)_install_setup_requires()
-> dist.parse_config_files(ignore_option_errors=True)
  /usr/lib/python2.7/site-packages/setuptools/dist.py(704)parse_config_files()
-> self._parse_config_files(filenames=filenames)
  /usr/lib/python2.7/site-packages/setuptools/dist.py(601)_parse_config_files()
-> (parser.read_file if six.PY3 else parser.readfp)(reader)
> /usr/lib64/python2.7/ConfigParser.py(310)readfp()
-> def readfp(self, fp, filename=None):
(Pdb) fp
<_io.TextIOWrapper name='setup.cfg' encoding='ANSI_X3.4-1968'>

Metadata Update from @bignose:
- Issue untagged with: more-info

5 years ago

bignose wrote:

I am unable to reproduce the behaviour:
[…]
$ python2 -c 'import setuptools; print(setuptools.version)'
40.2.0

This revealed that I had an old library clobbering newer updates to Setuptools.

I am unable to reproduce the reported behaviour with Python 2.7.15 and Setuptools 40.8.0:

$ python2 --version
Python 2.7.15+

$ python2 -c 'import setuptools; print(setuptools.__version__, setuptools.__file__)'
('40.8.0', '/home/bignose/Projects/python/python-daemon/venv.py2.7/local/lib/python2.7/site-packages/setuptools/__init__.pyc')

$ PYTHON=$(which python2) make clean
/home/bignose/Projects/python/python-daemon/venv.py2.7/bin/python2 -m setup "clean"
running clean
rm -f -r /home/bignose/Projects/python/python-daemon/trunk/build/ /home/bignose/Projects/python/python-daemon/trunk/dist/ /home/bignose/Projects/python/python-daemon/trunk/__pycache__/ /home/bignose/Projects/python/python-daemon/trunk/*.egg-info /home/bignose/Projects/python/python-daemon/trunk/.eggs/

$ python2 -m setup egg_info build
running egg_info
creating python_daemon.egg-info
writing requirements to python_daemon.egg-info/requires.txt
writing python_daemon.egg-info/PKG-INFO
writing top-level names to python_daemon.egg-info/top_level.txt
writing dependency_links to python_daemon.egg-info/dependency_links.txt
writing manifest file 'python_daemon.egg-info/SOURCES.txt'
reading manifest file 'python_daemon.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'python_daemon.egg-info/SOURCES.txt'
running write_version_info
writing version info to python_daemon.egg-info/version_info.json
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/daemon
copying daemon/_metadata.py -> build/lib.linux-x86_64-2.7/daemon
copying daemon/__init__.py -> build/lib.linux-x86_64-2.7/daemon
copying daemon/pidfile.py -> build/lib.linux-x86_64-2.7/daemon
copying daemon/runner.py -> build/lib.linux-x86_64-2.7/daemon
copying daemon/daemon.py -> build/lib.linux-x86_64-2.7/daemon

Can you provide some more steps that I can do to reproduce the behaviour in this issue?

Metadata Update from @bignose:
- Issue tagged with: more-info

5 years ago

Of course, for build everything we use the hasher tool: https://en.altlinux.org/Hasher
The default locale is as follows:

locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=

And if I run LANG=C.UTF-8 python setup.py build the problem is gone.

Metadata Update from @bignose:
- Issue untagged with: more-info

5 years ago

This is a problem on anything older than 3.6 / 3.7.

Since 3.7 upstream (3.6 Fedora), C locale is coerced to C.utf-8.

See https://fedoraproject.org/wiki/Changes/python3_c.utf-8_locale and https://www.python.org/dev/peps/pep-0538/

A workaround is to do either of the following:

  • set LANG=C.utf-8 (or any other UTF-8 locale) when building
  • remove “unciode quotation marks” from setup.cfg

This is a problem on anything older than 3.6 / 3.7.

Sorry that a solution was not found for this.

All Python versions older than 3.6 are totally unsupported now. I am closing this issue as no longer relevant to the project. Thanks again!

Metadata Update from @bignose:
- Issue close_status updated to: Invalid
- Issue status updated to: Closed (was: Open)

3 years ago

As of version 40.9.0, Setuptools ignores encoding declarations and simply requires the text to be encoded as UTF-8.

Login to comment on this ticket.

Metadata
Related Pull Requests
  • #33 Closed 3 years ago