pypa / virtualenv

Virtual Python Environment builder
https://virtualenv.pypa.io
MIT License
4.8k stars 1.03k forks source link

sphinx fails to build docs on Linux, trying to call `/usr/bin/towncrier.8` #1847

Closed mgorny closed 4 years ago

mgorny commented 4 years ago

Issue

$ sphinx-build docs out
Running Sphinx v2.4.4

Configuration error:
There is a programmable error in your configuration file:

Traceback (most recent call last):
  File "/usr/lib/python3.8/site-packages/sphinx/config.py", line 348, in eval_config_file
    execfile_(filename, namespace)
  File "/usr/lib/python3.8/site-packages/sphinx/util/pycompat.py", line 81, in execfile_
    exec(code, _globals)
  File "/tmp/virtualenv/docs/conf.py", line 68, in <module>
    generate_draft_news()
  File "/tmp/virtualenv/docs/conf.py", line 64, in generate_draft_news
    new = subprocess.check_output([str(towncrier), "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True)
  File "/usr/lib/python3.8/subprocess.py", line 411, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/usr/lib/python3.8/subprocess.py", line 489, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/usr/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/towncrier.8'

Apparently the code to blame is:

def generate_draft_news():
    root = Path(__file__).parents[1]
    exe = Path(sys.executable)
    towncrier = exe.with_name("towncrier{}".format(exe.suffix))
    new = subprocess.check_output([str(towncrier), "--draft", "--version", "NEXT"], cwd=root, universal_newlines=True)
    (root / "docs" / "_draft.rst").write_text("" if "No significant changes" in new else new)

I guess this code is meant to append .exe on Windows. However, when running via pythonX.Y executable, on Linux the suffix is .Y, and it gets wrongly appended to towncrier executable name.

Environment

Provide at least:

Package                       Version
----------------------------- ------------
aiocontextvars                0.2.2
aiohttp                       3.6.2
alabaster                     0.7.12
aniso8601                     8.0.0
apipkg                        1.5
appdirs                       1.4.4
argh                          0.26.2
arrow                         0.15.6
asgiref                       3.2.7
async-generator               1.10
async-timeout                 3.0.1
atomicwrites                  1.4.0
attrs                         19.3.0
Automat                       20.2.0
aws-sam-translator            1.22.0
aws-xray-sdk                  2.4.2
Babel                         2.8.0
babelfish                     0.5.5
backcall                      0.1.0
backports                     1.0
backports.tempfile            1.0
backports.unittest-mock       1.5
backports.weakref             1.0.post1
basho-erlastic                2.1.1
bcrypt                        3.1.7
beautifulsoup4                4.8.2
betamax                       0.8.1
bleach                        3.1.5
blessings                     1.7
blinker                       1.4
botocore                      1.16.7
bottle                        0.12.18
bpython                       0.19
breathe                       4.14.1
brotlipy                      0.7.0
cached-property               1.5.1
cairocffi                     1.1.0
CairoSVG                      2.4.2
catfish                       1.4.13
certifi                       2020.4.5.1
cffi                          1.14.0
cfn-lint                      0.30.1
chai                          1.1.2
Chameleon                     3.7.2
chardet                       3.0.4
cheroot                       8.3.0
CherryPy                      18.5.0
click                         7.1.2
click-default-group           1.2.2
click-log                     0.3.2
click-threading               0.4.4
cliff                         3.1.0
cloudpickle                   1.4.1
cmd2                          0.10.1
colorama                      0.4.3
colorclass                    2.2.0
colorspacious                 1.1.2
commonmark                    0.9.1
ConfigArgParse                1.2.3
configobj                     5.0.6
constantly                    15.1.0
contextlib2                   0.6.0.post1
cookies                       2.2.1
cppy                          1.1.0
cryptography                  2.9
cssselect                     1.1.0
cssselect2                    0.2.2
csv23                         0.3.2
curtsies                      0.3.0
cycler                        0.10.0
Cython                        0.29.19
ddt                           1.2.1
decorator                     4.4.2
defcon                        0.6.0
defusedxml                    0.6.0
Deprecated                    1.2.10
dicttoxml                     1.7.4
diffmask                      0.3.3
dill                          0.3.1.1
discogs-client                2.2.1
distlib                       0.3.0
dj-database-url               0.5.0
Django                        3.0.7
django-otp                    0.9.0
dnspython                     1.16.0
docker                        4.2.0
docopt                        0.6.2
docutils                      0.16
ecdsa                         0.15
eclean-kernel                 2.99.1
elementpath                   1.4.5
email-validator               1.1.1
entrypoints                   0.3
eventlet                      0.25.1
execnet                       1.7.1
extras                        1.0.0
fasteners                     0.15
fastimport                    0.9.8
feedparser                    5.2.1
file-magic                    0.4.0
filelock                      3.0.12
fixtures                      3.0.0
Flask                         1.1.2
Flask-Babel                   1.0.0
Flask-Sphinx-Themes           1.0.2
Flask-WTF                     0.14.3
fonttools                     4.1.0
freezegun                     0.3.15
fs                            2.4.9
future                        0.18.2
gander                        0.0.1
gaupol                        1.8
gdbus-codegen                 2.64.3
gemato                        14.4
gentoolkit                    9999
gentoopm                      0.3.1
genty                         1.3.2
GeoIP                         1.3.2
gevent                        20.5.2
git-review                    1.28.0
gitdb                         4.0.5
GitPython                     3.1.3
glep63-check                  9
gmpy2                         2.0.8
gpg                           1.13.1
gpyutils                      0.4.2
greenlet                      0.4.15
guessit                       3.1.1
h11                           0.9.0
h2                            3.2.0
hg-evolve                     10.0.0
hpack                         3.0.0
html5lib                      1.0.1
http-parser                   0.9.0
httpbin                       0.7.0
httplib2                      0.18.1
httpretty                     1.0.2
httpstat                      1.2.1
hyperframe                    5.2.0
hyperlink                     19.0.0
hypothesis                    4.57.1
idna                          2.9
idna-ssl                      1.1.0
imagesize                     1.1.0
img2pdf                       0.3.4
immutables                    0.11
importlib-metadata            1.6.0
importlib-resources           1.5.0
include-server                3.3.3
incremental                   17.5.0
iniparse                      0.4
iocapture                     0.1.2
ipython-genutils              0.2.0
iso8601                       0.1.12
itsdangerous                  1.1.0
jaraco.classes                3.1.0
jaraco.collections            3.0.0
jaraco.envs                   2.0.0
jaraco.functools              3.0.1
jaraco.text                   3.2.0
java-config                   2.2.0
javatoolkit                   0.5.0
jedi                          0.17.0
jeepney                       0.4.3
Jinja2                        2.11.2
jmespath                      0.9.3
joblib                        0.14.1
jsondiff                      1.2.0
jsonpatch                     1.25
jsonpickle                    1.4.1
jsonpointer                   2.0
jsonref                       0.1
jsonschema                    3.2.0
keyring                       21.2.1
kiwisolver                    1.2.0
lesscpy                       0.14.0
linecache2                    1.0.0
lit                           0.10.0.dev0
lockfile                      0.12.2
lxml                          4.5.1
M2Crypto                      0.35.2
m2r                           0.2.1
Mako                          1.1.3
Markdown                      3.2.2
markdown2                     2.3.8
MarkupSafe                    1.1.1
marshmallow                   3.5.1
matplotlib                    3.2.1
memory-profiler               0.57.0
mercurial                     5.4
mergedict                     1.0.0
meson                         0.54.2
mistune                       0.8.4
mock                          3.0.5
monotonic                     1.5
more-itertools                5.0.0
moto                          1.3.14
msgpack                       0.6.2
multidict                     4.7.6
munch                         2.5.0
mypy                          0.760
mypy-extensions               0.4.3
nattka                        0.2.6
networkx                      2.4
nltk                          3.5
nose                          1.3.7
numpy                         1.18.5
oauth2                        1.9.0.post1
oauth2client                  4.1.3
oauthlib                      3.1.0
objgraph                      3.4.1
olefile                       0.46
packaging                     20.4
parameterized                 0.7.4
paramiko                      2.7.1
parso                         0.7.0
passlib                       1.7.2
Paste                         3.4.1
PasteDeploy                   2.1.0
path                          14.0.1
pathlib2                      2.3.5
pathspec                      0.8.0
pathtools                     0.1.2
pbr                           5.4.5
Pebble                        4.5.3
pexpect                       4.8.0
pickleshare                   0.7.5
Pillow                        7.1.2
pip                           20.1.1
pkgcheck                      0.7.6
pkgconfig                     1.5.0
pkgcore                       0.10.12
pkginfo                       1.5.0.1
pluggy                        0.13.1
ply                           3.11
portage                       2.3.100
portend                       2.6
pretend                       1.0.9
prettytable                   0.7.2
priority                      1.3.0
prompt-toolkit                2.0.10
protobuf                      3.11.4
psutil                        5.7.0
psycopg2                      2.8.4
ptyprocess                    0.6.0
py                            1.8.0
py-ubjson                     0.15.0
pyaes                         1.6.1
pyaml                         15.8.2
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pybind11                      2.5.0
pycairo                       1.18.2
pycares                       3.1.1
pyclipper                     1.1.0.post3
pycodestyle                   2.5.0
PyContracts                   1.8.14
pycparser                     2.20
pycryptodome                  3.9.7
pycurl                        7.43.0.5
pydot                         1.4.1
pyenchant                     3.1.0
pyflakes                      2.2.0
pyftpdlib                     1.5.6
pygal                         2.4.0
pygit2                        1.2.0
PyGithub                      1.51
Pygments                      2.5.2
PyGObject                     3.34.0
pyh2o                         0
PyHamcrest                    2.0.2
PyJWT                         1.7.1
pykwalify                     1.7.0
pylibacl                      0.5.4
pymountboot                   0.2.3
PyNaCl                        1.3.0
pynvim                        0.4.0
pyOpenSSL                     19.1.0
pyparsing                     2.4.7
pyperclip                     1.7.0
pypiserver                    1.3.2
pypng                         0.0.20
pyproject2setuppy             7
PyQRCode                      1.2.1
PyQt5                         5.14.2
PyQt5-sip                     4.19.22
pyquery                       1.4.1
pyrqlite                      2.0
pyrsistent                    0.15.6
pysendfile                    2.0.1
pyserial                      3.4
PySocks                       1.7.1
pyte                          0.8.0
pytest                        4.6.10
pytest-asyncio                0.12.0
pytest-expect                 1.1.0
pytest-fixture-config         1.7.0
pytest-forked                 1.1.3
pytest-httpbin                1.0.0
pytest-localserver            0.5.0
pytest-mock                   3.1.1
pytest-services               2.0.1
pytest-shutil                 1.7.0
pytest-timeout                1.3.4
pytest-virtualenv             1.7.0
pytest-xdist                  1.32.0
pytest-xprocess               0.13.1
python-bugzilla               2.3.0
python-dateutil               2.8.1
python-distutils-extra        2.39
python-gflags                 3.1.2
python-jose                   3.1.0
python-lzo                    1.12
python-mimeparse              1.6.0
python-snappy                 0.5.1
pytidylib                     0.3.2
pytools                       2020.1
PyTrie                        0.3.1
pytz                          2020.1
PyX                           0.15
pyxattr                       0.7.1
pyxdg                         0.26
PyYAML                        5.3.1
pyzmq                         19.0.0
qrcode                        6.1
QScintilla                    2.11.4
ratelimit                     1.4.1
readme-renderer               26.0
readthedocs-sphinx-ext        1.0.4
rebulk                        2.0.1
recommonmark                  0.6.0
regex                         2020.2.20
reportlab                     3.5.42
repoze.lru                    0.7
requests                      2.23.0
requests-mock                 1.7.0
requests-oauthlib             1.3.0
requests-toolbelt             0.9.1
responses                     0.10.7
rfc3339-validator             0.1.2
rfc3986-validator             0.1.1
rfc3987                       1.3.8
Routes                        2.4.1
rsa                           4.0
rst2pdf                       0.93.dev0
ruamel.std.pathlib            0.6.4
s3transfer                    0.3.1
scikit-learn                  0.22.2.post1
scons                         3.1.2
scour                         0.37
scripttest                    1.3
scrypt                        0.8.15
SecretStorage                 3.1.2
selenium                      3.141.0
selinux                       3.0
serpent                       1.30
service-identity              18.1.0
setuptools                    46.4.0
setuptools-git                1.2
setuptools-scm                4.1.2
simplejson                    3.17.0
sip                           4.19.22
six                           1.15.0
smart-live-rebuild            1.3.6
smmap                         3.0.4
snakeoil                      0.8.8
snowballstemmer               2.0.0
socketpool                    0.5.3
sortedcontainers              2.1.0
soupsieve                     1.9.6
speaklater                    1.3
Sphinx                        2.4.4
sphinx-rtd-theme              0.4.3
sphinx-selective-exclude      1.0.2
sphinx-testing                1.0.1
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        1.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.4
sphinxcontrib-spelling        5.0.0
sphinxcontrib-websupport      1.1.0
SQLAlchemy                    1.3.17
sqlparse                      0.3.1
sshpubkeys                    3.1.0
stevedore                     2.0.0
strict-rfc3339                0.7
sure                          1.4.11
sybil                         1.3.0
tabulate                      0.8.6
tap.py                        2.4
tblib                         1.6.0
tempora                       3.0.0
termcolor                     1.1.0
testfixtures                  6.14.1
testpath                      0.4.4
testresources                 2.0.1
testscenarios                 0.5.0
testtools                     2.4.0
texttable                     1.6.2
tinycss2                      1.0.2
toml                          0.10.1
tornado                       6.0.4
tortoisehg                    5.3.2
tox                           3.15.1
tqdm                          4.46.1
traceback2                    1.4.0
traitlets                     4.3.3
trustme                       0.6.0
twine                         3.1.1
Twisted                       20.3.0
twython                       3.7.0
typed-ast                     1.4.1
typing-extensions             3.7.4.1
tzlocal                       2.1
u-msgpack-python              2.6.0
ujson                         2.0.3
unicodecsv                    0.14.1
unittest-mixins               1.6
urllib3                       1.25.9
urwid                         2.1.0
vcrpy                         4.0.2
versioneer                    0.18
virtualenv                    20.0.21
virtualenv-clone              0.5.3
voluptuous                    0.11.5
waitress                      1.4.4
watchdog                      0.10.2
wcwidth                       0.2.2
webcolors                     1.10
webencodings                  0.5.1
WebOb                         1.8.6
websocket-client              0.56.0
WebTest                       2.0.35
Werkzeug                      1.0.1
wheel                         0.34.2
Whoosh                        2.7.4
wrapt                         1.12.1
WSGIProxy2                    0.4.6
wsproto                       0.15.0
WTForms                       2.2.1
xcffib                        0.9.0
xlrd                          1.2.0
xlwt                          1.3.0
xmlschema                     1.2.0
xmltodict                     0.12.0
yapf                          0.30.0
Yapsy                         1.12.2
yarl                          1.4.2
youtube-dl                    2020.5.29
zc.lockfile                   2.0
zipp                          1.0.0
zope.component                4.4.1
zope.event                    4.4
zope.interface                5.1.0
zope.testing                  4.7
zstandard                     0.13.0

Output of the virtual environment creation

n/a

mgorny commented 4 years ago

I should probably also mention that it's silly to assume that Python and towncrier must reside exactly in the same directory. This might be true in virtualenv but there's really no reason to force people to build a virtualenv just to build docs.

gaborbernat commented 4 years ago

This might be true in virtualenv but there's really no reason to force people to build a virtualenv just to build docs.

The documentation building is only supported when invoked via tox that ensures this guarantee. It's not silly to restrict the supported environments to ease with maintenance.

it's silly to assume that

In future, please choose your words better when talking about other peoples work, stuff they do for free and in their free time. The word `silly is very condescending, and comes across offensive.