Issue 19570: distutils' Command.ensure_dirname fails on Unicode (original) (raw)

Created on 2013-11-13 13:11 by saschpe, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)

msg202741 - (view)

Author: Sascha Peilicke (saschpe)

Date: 2013-11-13 13:11

Encountered an isssue with Unicode paths when invoking Sphinx' distutils command (i.e. 'setup.py build_sphinx'):

$ python setup.py build_sphinx running build_sphinx error: 'source_dir' must be a directory name (got doc/source)

... (Pdb) l 96 for root, dirnames, filenames in os.walk(guess): 97 if 'conf.py' in filenames: 98 return root 99 return None 100
101 -> def finalize_options(self): 102 if self.source_dir is None: 103 self.source_dir = self._guess_source_dir() 104 self.announce('Using source directory %s' % self.source_dir) 105 self.ensure_dirname('source_dir') 106 if self.source_dir is None: (Pdb) n

/usr/lib/python2.7/site-packages/sphinx/setup_command.py(102)finalize_options() -> if self.source_dir is None: (Pdb) n /usr/lib/python2.7/site-packages/sphinx/setup_command.py(105)finalize_options() -> self.ensure_dirname('source_dir') (Pdb) s --Call-- /usr/lib64/python2.7/distutils/cmd.py(266)ensure_dirname() -> def ensure_dirname(self, option): (Pdb) s ... --Call-- /usr/lib64/python2.7/distutils/cmd.py(253)_ensure_tested_string() -> def _ensure_tested_string(self, option, tester, (Pdb) /usr/lib64/python2.7/distutils/cmd.py(255)_ensure_tested_string() -> val = self._ensure_stringlike(option, what, default)

Command.ensure_dirname (likewise ensure_filename) fails because _ensure_stringlike only tests for isistance(..., str) rather than isinstance(..., types.StringTypes).

msg202742 - (view)

Author: STINNER Victor (vstinner) * (Python committer)

Date: 2013-11-13 13:13

This is more a feature request than a bug. You should use an encoded path, or upgrade to Python 3 which handles Unicode correctly.

msg202749 - (view)

Author: Sascha Peilicke (saschpe)

Date: 2013-11-13 13:51

Happens since Sphinx-1.2b3, here's some context: https://bitbucket.org/birkenfeld/sphinx/issue/1142

msg212456 - (view)

Author: Matt Riedemann (mriedem)

Date: 2014-02-28 16:15

For what it's worth, I'm building openstack docs on master (icehouse-3) for ceilometer, nova, cinder, heat, glance, keystone, and neutron (plus the clients) using sphinx 1.2.1 without this problem (unless I'm just not aware of it?). Anyway, I came across that from this github change for openstack's global-requirements:

https://github.com/openstack/requirements/commit/0e8862e958813a031fe7398440e8a3866b42a8e4

msg268461 - (view)

Author: Adam Bartoš (Drekin) *

Date: 2016-06-13 19:15

Recently, I was also hit by this when trying to autoset sys.argv to a list of Unicode string (see https://github.com/Drekin/win-unicode-console/issues/20#issuecomment-225638271 ).

It would be nice to have this fixed. It seems to me (I may be wrong) that every occurence of isinstance(…, str) is a potential bug in Python 2.7. Either it should be spelled out as isinstance(…, bytes) or there should be isinstance(…, types.StringTypes) or even isinstance(…, unicode).

msg382231 - (view)

Author: Irit Katriel (iritkatriel) * (Python committer)

Date: 2020-12-01 10:51

Python 2-only issue.

History

Date

User

Action

Args

2022-04-11 14:57:53

admin

set

github: 63769

2020-12-01 10:51:45

iritkatriel

set

status: open -> closed

nosy: + iritkatriel
messages: +

resolution: out of date
stage: resolved

2016-06-13 19:15:17

Drekin

set

nosy: + Drekin
messages: +

2014-02-28 16:15:57

mriedem

set

nosy: + mriedem
messages: +

2013-12-11 22:32:20

doughellmann

set

nosy: + doughellmann

2013-11-13 19:47:48

ned.deily

set

nosy: + georg.brandl

2013-11-13 13:51:55

saschpe

set

messages: +

2013-11-13 13:13:27

vstinner

set

nosy: + vstinner
messages: +

2013-11-13 13:11:57

saschpe

create