pypi2nix icon indicating copy to clipboard operation
pypi2nix copied to clipboard

pypi2nix fails to find requirements.txt, yet pip doesn't care

Open rihardsk opened this issue 5 years ago • 0 comments
trafficstars

Description

pypi2nix fails to find requirements.txt, when trying to generate expressions for mautrix-hangouts, yet pip has no problems installing it -- pip install mautrix-hangouts works just fine.

❯ pypi2nix -V python3 -e mautrix-hangouts
INFO: pypi2nix v2.0.4 running ...
INFO: Downloading wheels and creating wheelhouse ...
INFO: Downloading runtime requirements
    ERROR: Command errored out with exit status 1:
     command: /nix/store/5r5s9vz8zvqq4inqwygagf6hwhsrlqz9-python3-3.7.6-env/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/tmpjcdxt4wc/pip-download-703_ssjz/mautrix-hangouts/setup.py'"'"'; __file__='"'"'/tmp/tmpjcdxt4wc/pip-download-703_ssjz/mautrix-hangouts/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/tmpjcdxt4wc/pip-download-703_ssjz/mautrix-hangouts/pip-egg-info
         cwd: /tmp/tmpjcdxt4wc/pip-download-703_ssjz/mautrix-hangouts/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/tmpjcdxt4wc/pip-download-703_ssjz/mautrix-hangouts/setup.py", line 11, in <module>
        with open("requirements.txt") as reqs:
    FileNotFoundError: [Errno 2] No such file or directory: 'requirements.txt'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.dev0; however, version 20.0.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
ERROR: Collecting mautrix-hangouts
ERROR:   Downloading mautrix-hangouts-0.1.0.dev8.tar.gz (60 kB)
ERROR:   Saved /tmp/tmpjcdxt4wc/download/mautrix-hangouts-0.1.0.dev8.tar.gz
Do you want to report above issue (a browser will open with prefilled details of issue)? [y/N]: y
Error: While trying to run the command something went wrong.

requierments.txt indeed isn't there at the root of the mautrix-hangouts-0.1.0.dev8.tar.gz archive, but pip doesn't care. Here's what's inside the archive:

❯ tree mautrix-hangouts-0.1.0.dev8 
mautrix-hangouts-0.1.0.dev8
├── alembic
│   ├── env.py
│   └── versions
│       ├── 41712fc6d14b_add_user_portal_puppet_mappings_to_db.py
│       ├── 63ea9db2aa00_add_receiver_and_index_fields_to_.py
│       ├── ba113d486f7f_store_custom_puppet_next_batch_in_.py
│       ├── bfb775ce2cee_initial_revision.py
│       └── fb42f7a67a6b_add_receiver_field_to_portals.py
├── alembic.ini
├── example-config.yaml
├── mautrix_hangouts
│   ├── commands
│   │   ├── auth.py
│   │   ├── handler.py
│   │   └── __init__.py
│   ├── config.py
│   ├── context.py
│   ├── db
│   │   ├── __init__.py
│   │   ├── message.py
│   │   ├── portal.py
│   │   ├── puppet.py
│   │   └── user.py
│   ├── get_version.py
│   ├── __init__.py
│   ├── __main__.py
│   ├── matrix.py
│   ├── portal.py
│   ├── puppet.py
│   ├── sqlstatestore.py
│   ├── user.py
│   ├── util
│   │   ├── color_log.py
│   │   ├── hangups_try_auth.py
│   │   └── __init__.py
│   ├── version.py
│   └── web
│       ├── auth.py
│       ├── __init__.py
│       └── static
│           ├── favicon.png
│           ├── loader.css
│           ├── login.css
│           ├── login.html
│           ├── login.js
│           └── login-redirect.html
├── mautrix_hangouts.egg-info
│   ├── dependency_links.txt
│   ├── entry_points.txt
│   ├── PKG-INFO
│   ├── requires.txt
│   ├── SOURCES.txt
│   └── top_level.txt
├── PKG-INFO
├── README.md
├── setup.cfg
└── setup.py

Here are the contents of setup.py

import setuptools
import glob

from mautrix_hangouts.get_version import git_tag, git_revision, version, linkified_version

try:
    long_desc = open("README.md").read()
except IOError:
    long_desc = "Failed to read README.md"

with open("requirements.txt") as reqs:
    install_requires = reqs.read().splitlines()

with open("mautrix_hangouts/version.py", "w") as version_file:
    version_file.write(f"""# Generated in setup.py

git_tag = {git_tag!r}
git_revision = {git_revision!r}
version = {version!r}
linkified_version = {linkified_version!r}
""")

setuptools.setup(
    name="mautrix-hangouts",
    version="0.1.0.dev8",
    url="https://github.com/tulir/mautrix-hangouts",

    author="Tulir Asokan",
    author_email="[email protected]",

    description="A Matrix-Hangouts puppeting bridge.",
    long_description=long_desc,
    long_description_content_type="text/markdown",

    packages=setuptools.find_packages(),

    install_requires=install_requires,

    classifiers=[
        "Development Status :: 2 - Pre-Alpha",
        "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
        "Topic :: Communications :: Chat",
        "Framework :: AsyncIO",
        "Programming Language :: Python",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.6",
        "Programming Language :: Python :: 3.7",
        "Programming Language :: Python :: 3.8",
    ],
    entry_points="""
        [console_scripts]
        mautrix-hangouts=mautrix_hangouts.__main__:main
    """,
    package_data={"mautrix_hangouts": [
        "web/static/*.png", "web/static/*.css", "web/static/*.html", "web/static/*.js",
    ]},
    data_files=[
        (".", ["example-config.yaml", "alembic.ini"]),
        ("alembic", ["alembic/env.py"]),
        ("alembic/versions", glob.glob("alembic/versions/*.py"))
    ],
)

Any ideas what's going on here? How is pip handling the fact that setup.py wants to open requirements.txt but it's not present?

rihardsk avatar Mar 20 '20 19:03 rihardsk