#189 [autosquash] %pyproject_buildrequires now fails when it encounters an invalid requirement + make some macros private
Closed 2 years ago by churchyard. Opened 2 years ago by churchyard.
rpms/ churchyard/pyproject-rpm-macros fail_invalid_versions  into  rawhide

file modified
+34
@@ -268,8 +268,42 @@ 

  

  Some valid Python version specifiers are not supported.

  

+ When a dependency is specified via an URL or local path, for example as:

+ 

+     https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip

+     /some/path/foo-1.2.3.tar.gz

+     git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3

+ 

+ The `%pyproject_buildrequires` macro is unable to convert it to an appropriate RPM requirement and will fail.

+ If the URL contains the `packageName @` prefix as specified in [PEP 508],

+ the requirement will be generated without a version constraint:

+ 

+     appdirs@https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip

+     foo@file:///some/path/foo-1.2.3.tar.gz

+ 

+ Will be converted to:

+ 

+     python3dist(appdirs)

+     python3dist(foo)

+ 

+ Alternatively, when an URL requirement parsed from a text file

+ given as positional argument to `%pyproject_buildrequires`

+ contains the `#egg=packageName` fragment,

+ as documented in [pip's documentation]:

+ 

+     git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3#egg=sphinx

+ 

+ The requirements will be converted to package names without versions, e.g.:

+ 

+     python3dist(sphinx)

+ 

+ However upstreams usually only use direct URLs for their requirements as workarounds,

+ so be prepared for problems.

+ 

+ [PEP 508]: https://www.python.org/dev/peps/pep-0508/

  [PEP 517]: https://www.python.org/dev/peps/pep-0517/

  [PEP 518]: https://www.python.org/dev/peps/pep-0518/

+ [pip's documentation]: https://pip.pypa.io/en/stable/cli/pip_install/#vcs-support

  

  

  Testing the macros

file modified
+9 -9
@@ -11,8 +11,8 @@ 

  %_pyproject_builddir %{_builddir}%{?buildsubdir:/%{buildsubdir}}/.pyproject-builddir

  

  %pyproject_files %{_builddir}/pyproject-files

- %pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo

- %pyproject_record %{_builddir}/pyproject-record

+ %_pyproject_ghost_distinfo %{_builddir}/pyproject-ghost-distinfo

+ %_pyproject_record %{_builddir}/pyproject-record

  

  # Avoid leaking %%{_pyproject_builddir} to pytest collection

  # https://bugzilla.redhat.com/show_bug.cgi?id=1935212
@@ -34,7 +34,7 @@ 

    %py3_shebang_fix %{buildroot}%{_bindir}/*

    rm -rfv %{buildroot}%{_bindir}/__pycache__

  fi

- rm -f %{pyproject_ghost_distinfo}

+ rm -f %{_pyproject_ghost_distinfo}

  site_dirs=()

  # Process %%{python3_sitelib} if exists

  if [ -d %{buildroot}%{python3_sitelib} ]; then
@@ -47,25 +47,25 @@ 

  # Process all *.dist-info dirs in sitelib/sitearch

  for site_dir in ${site_dirs[@]}; do

    for distinfo in %{buildroot}$site_dir/*.dist-info; do

-     echo "%ghost ${distinfo#%{buildroot}}" >> %{pyproject_ghost_distinfo}

+     echo "%ghost ${distinfo#%{buildroot}}" >> %{_pyproject_ghost_distinfo}

      sed -i 's/pip/rpm/' ${distinfo}/INSTALLER

      PYTHONPATH=%{_rpmconfigdir}/redhat \\

        %{__python3} -B %{_rpmconfigdir}/redhat/pyproject_preprocess_record.py \\

-       --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{pyproject_record}

+       --buildroot %{buildroot} --record ${distinfo}/RECORD --output %{_pyproject_record}

      rm -fv ${distinfo}/RECORD

      rm -fv ${distinfo}/REQUESTED

    done

  done

- lines=$(wc -l %{pyproject_ghost_distinfo} | cut -f1 -d" ")

+ lines=$(wc -l %{_pyproject_ghost_distinfo} | cut -f1 -d" ")

  if [ $lines -ne 1 ]; then

    echo -e "\\n\\nWARNING: %%%%pyproject_extras_subpkg won't work without explicit -i or -F, found $lines dist-info directories.\\n\\n" >&2

-   rm %{pyproject_ghost_distinfo}  # any attempt to use this will fail

+   rm %{_pyproject_ghost_distinfo}  # any attempt to use this will fail

  fi

  }

  

  

  # Note: the three times nested questionmarked -i -f -F pattern means: If none of those options was used -- in that case, we inject our own -f

- %pyproject_extras_subpkg(n:i:f:F) %{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{?!-i:%{?!-f:%{?!-F: -f %{pyproject_ghost_distinfo}}}} %**}}}

+ %pyproject_extras_subpkg(n:i:f:F) %{expand:%{?python_extras_subpkg:%{python_extras_subpkg%{?!-i:%{?!-f:%{?!-F: -f %{_pyproject_ghost_distinfo}}}} %**}}}

  

  

  %pyproject_save_files() %{expand:\\\
@@ -75,7 +75,7 @@ 

    --sitelib "%{python3_sitelib}" \\

    --sitearch "%{python3_sitearch}" \\

    --python-version "%{python3_version}" \\

-   --pyproject-record "%{pyproject_record}" \\

+   --pyproject-record "%{_pyproject_record}" \\

    %{*}

  }

  

file modified
+6 -1
@@ -6,7 +6,7 @@ 

  

  # Keep the version at zero and increment only release

  Version:        0

- Release:        44%{?dist}

+ Release:        45%{?dist}

  

  # Macro files

  Source001:      macros.pyproject
@@ -109,6 +109,11 @@ 

  %license LICENSE

  

  %changelog

+ * Tue Jul 20 2021 Miro Hrončok <mhroncok@redhat.com> - 0-45

+ - %%pyproject_buildrequires now fails when it encounters an invalid requirement

+ - Fixes: rhbz#1983053

+ - Rename %%_pyproject_ghost_distinfo and %%_pyproject_record to indicate they are private

+ 

  * Fri Jul 09 2021 Python Maint <python-maint@redhat.com> - 0-44

  - Escape weird paths generated by %%pyproject_save_files

  - Fixes rhbz#1976363

file modified
+49 -16
@@ -11,12 +11,16 @@ 

  import tempfile

  import email.parser

  import pathlib

+ import urllib

  

  

  # Some valid Python version specifiers are not supported.

  # Allow only the forms we know we can handle.

  VERSION_RE = re.compile(r'[a-zA-Z0-9.-]+(\.\*)?')

  

+ # We treat this as comment in requirements files, as does pip

+ COMMENT_RE = re.compile(r'(^|\s+)#.*$')

+ 

  

  class EndPass(Exception):

      """End current pass of generating requirements"""
@@ -50,6 +54,31 @@ 

          print_err('HOOK STDOUT:', line)

  

  

+ def pkgname_from_egg_fragment(requirement_str):

+     parsed_url = urllib.parse.urlparse(requirement_str)

+     parsed_fragment = urllib.parse.parse_qs(parsed_url.fragment)

+     if 'egg' in parsed_fragment:

+         return parsed_fragment['egg'][0]

+     return None

+ 

+ 

+ def guess_reason_for_invalid_requirement(requirement_str):

+     if ':' in requirement_str:

+         return (

+             'It might be an URL. '

+             '%pyproject_buildrequires cannot handle all URL-based requirements. '

+             'Add PackageName@ (see PEP 508) to the URL to at least require any version of PackageName.'

+         )

+     if '/' in requirement_str:

+         return (

+             'It might be a local path. '

+             '%pyproject_buildrequires cannot handle local paths as requirements. '

+             'Use an URL with PackageName@ (see PEP 508) to at least require any version of PackageName.'

+         )

+     # No more ideas

+     return None

+ 

+ 

  class Requirements:

      """Requirement printer"""

      def __init__(self, get_installed_version, extras=None,
@@ -81,18 +110,27 @@ 

                  return True

          return False

  

-     def add(self, requirement_str, *, source=None):

+     def add(self, requirement_str, *, source=None, allow_egg_pkgname=False):

          """Output a Python-style requirement string as RPM dep"""

          print_err(f'Handling {requirement_str} from {source}')

  

          try:

              requirement = Requirement(requirement_str)

-         except InvalidRequirement as e:

+         except InvalidRequirement:

+             if allow_egg_pkgname and (egg_name := pkgname_from_egg_fragment(requirement_str)):

+                 requirement = Requirement(egg_name)

+                 requirement.url = requirement_str

+             else:

+                 hint = guess_reason_for_invalid_requirement(requirement_str)

+                 message = f'Requirement {requirement_str!r} from {source} is invalid.'

+                 if hint:

+                     message += f' Hint: {hint}'

+                 raise ValueError(message)

+ 

+         if requirement.url:

              print_err(

-                 f'WARNING: Skipping invalid requirement: {requirement_str}\n'

-                 + f'    {e}',

+                 f'WARNING: Simplifying {requirement_str!r} to {requirement.name!r}.'

              )

-             return

  

          name = canonicalize_name(requirement.name)

          if (requirement.marker is not None and
@@ -128,7 +166,7 @@ 

                  if not VERSION_RE.fullmatch(str(specifier.version)):

                      raise ValueError(

                          f'Unknown character in version: {specifier.version}. '

-                         + '(This is probably a bug in pyproject-rpm-macros.)',

+                         + '(This might be a bug in pyproject-rpm-macros.)',

                      )

                  together.append(convert(python3dist(name, python3_pkgversion=self.python3_pkgversion),

                                          specifier.operator, specifier.version))
@@ -146,10 +184,10 @@ 

              print_err(f'Exiting dependency generation pass: {source}')

              raise EndPass(source)

  

-     def extend(self, requirement_strs, *, source=None):

+     def extend(self, requirement_strs, **kwargs):

          """add() several requirements"""

          for req_str in requirement_strs:

-             self.add(req_str, source=source)

+             self.add(req_str, **kwargs)

  

  

  def get_backend(requirements):
@@ -241,13 +279,7 @@ 

  def parse_requirements_lines(lines, path=None):

      packages = []

      for line in lines:

-         line, _, comment = line.partition('#')

-         if comment.startswith('egg='):

-             # not a real comment

-             # e.g. git+https://github.com/monty/spam.git@master#egg=spam&...

-             egg, *_ = comment.strip().partition(' ')

-             egg, *_ = egg.strip().partition('&')

-             line = egg[4:]

+         line = COMMENT_RE.sub('', line)

          line = line.strip()

          if line.startswith('-r'):

              recursed_path = line[2:].strip()
@@ -343,7 +375,8 @@ 

                  lines = req_file.read().splitlines()

                  packages = parse_requirements_lines(lines, pathlib.Path(req_file.name))

                  requirements.extend(packages,

-                                     source=f'requirements file {req_file.name}')

+                                     source=f'requirements file {req_file.name}',

+                                     allow_egg_pkgname=True)

              requirements.check(source='all requirement files')

          if use_build_system:

              backend = get_backend(requirements)

@@ -92,8 +92,7 @@ 

      [build-system]

      requires = ["pkg ~= 42", "foo"]

      build-backend = "foo.build"

-   stderr_contains: "WARNING: Skipping invalid requirement: pkg ~= 42"

-   result: 0

+   except: ValueError

  

  Asterisk in version with unsupported compatible operator:

    installed:
@@ -102,8 +101,34 @@ 

      [build-system]

      requires = ["pkg ~= 0.1.*", "foo"]

      build-backend = "foo.build"

-   stderr_contains: "WARNING: Skipping invalid requirement: pkg ~= 0.1.*"

-   result: 0

+   except: ValueError

+ 

+ Local path as requirement:

+   installed:

+     toml: 1

+   pyproject.toml: |

+     [build-system]

+     requires = ["./pkg-1.2.3.tar.gz", "foo"]

+     build-backend = "foo.build"

+   except: ValueError

+ 

+ Pip's egg=pkgName requirement not in requirements file:

+   installed:

+     toml: 1

+   pyproject.toml: |

+     [build-system]

+     requires = ["git+https://github.com/monty/spam.git@master#egg=spam", "foo"]

+     build-backend = "foo.build"

+   except: ValueError

+ 

+ URL without egg fragment as requirement:

+   installed:

+     toml: 1

+   pyproject.toml: |

+     [build-system]

+     requires = ["git+https://github.com/pkg-dev/pkg.git@96dbe5e3", "foo"]

+     build-backend = "foo.build"

+   except: ValueError

  

  Build system dependencies in pyproject.toml with extras:

    generate_extras: true
@@ -125,9 +150,9 @@ 

          "equal == 0.5.0",

          "arbitrary_equal === 0.6.0",

          "asterisk_equal == 0.6.*",

+         "appdirs@https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip",

          "multi[Extras1,Extras2] == 6.0",

          "combo >2, <5, != 3.0.0",

-         "invalid!!ignored",

          "py2 ; python_version < '2.7'",

          "py3 ; python_version > '3.0'",

      ]
@@ -145,11 +170,13 @@ 

      python3dist(equal) = 0.5

      python3dist(arbitrary-equal) = 0.6

      (python3dist(asterisk-equal) >= 0.6 with python3dist(asterisk-equal) < 0.7)

+     python3dist(appdirs)

      python3dist(multi) = 6

      python3dist(multi[extras1]) = 6

      python3dist(multi[extras2]) = 6

      ((python3dist(combo) < 3 or python3dist(combo) > 3) with python3dist(combo) < 5 with python3dist(combo) > 2)

      python3dist(py3)

+   stderr_contains: "WARNING: Simplifying 'appdirs@https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip' to 'appdirs'."

    result: 0

  

  Build system dependencies in pyproject.toml without extras:
@@ -576,6 +603,7 @@ 

      python3dist(paramiko)

      python3dist(sqlalchemy)

      python3dist(spam)

+   stderr_contains: "WARNING: Simplifying 'git+https://github.com/monty/spam.git@master#egg=spam' to 'spam'."

    result: 0

  

  With pyproject.toml, requirements file and without -N option:

@@ -28,6 +28,9 @@ 

  # we don't have pip-tools packaged in Fedora yet

  sed -i /pip-tools/d requirements/dev.in

  

+ # help the macros understand the URL in requirements/docs.in

+ sed -Ei 's/sphinx\.git@([0-9a-f]+)/sphinx.git@\1#egg=sphinx/' requirements/docs.in

+ 

  

  %generate_buildrequires

  # requirements/dev.in recursively includes tests.in and docs.in

@@ -59,9 +59,9 @@ 

  grep -F 'flake8: commands succeeded' toxlog

  

  # Internal check for our macros

- # making sure that %%{pyproject_ghost_distinfo} has the right content

- test -f %{pyproject_ghost_distinfo}

- test "$(cat %{pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setuptools_scm-%{version}.dist-info"

+ # making sure that %%{_pyproject_ghost_distinfo} has the right content

+ test -f %{_pyproject_ghost_distinfo}

+ test "$(cat %{_pyproject_ghost_distinfo})" == "%ghost %{python3_sitelib}/setuptools_scm-%{version}.dist-info"

  

  

  %files -n python3-setuptools_scm -f %{pyproject_files}

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1983053

The second commit is unrelated, but I don't want to open 2 conflicting PRs. The renamed macros are not used in Fedora, based on a grep over all the spec files.

Builds in https://copr.fedorainfracloud.org/coprs/churchyard/pyproject-buildrequires-fail-invalid/builds/

1 new commit added

  • Rename %_pyproject_ghost_distinfo and %_pyproject_record to indicate they are private
2 years ago

+1, looks good to me. Thank you.

python-platformdirs fails with:

Handling https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip from tox --print-deps-only: py310
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 1955, in parseString
    raise exc
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 3814, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found ':'  (at char 5), (line:1, col:6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 407, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 344, in generate_requires
    generate_tox_requirements(toxenv, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 299, in generate_tox_requirements
    requirements.extend(packages,
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 143, in extend
    self.add(req_str, source=source)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 87, in add
    requirement = Requirement(requirement_str)
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'://githu'": Expected stringEnd
error: Bad exit status from /var/tmp/rpm-tmp.xTMjhs (%generate_buildrequires)

Due to https://github.com/platformdirs/platformdirs/blob/2.0.0/tox.ini#L7

We might need to adapt the error message here :/

python-shellingham fails due to a previous change in the macros, fixed in https://src.fedoraproject.org/rpms/python-shellingham/pull-request/5

I think we should also make sure the invalid requirement is spelled out in the error.

I think we should also make sure the invalid requirement is spelled out in the error.

Do you want to do it? Or I can do it by myself.

Do you want to do it? Or I can do it by myself.

I have it open here, I'll finish it.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

This also fails with the markupsafe package in our CI:

Handling git+https://github.com/sphinx-doc/sphinx.git@96dbe5e3 from requirements file requirements/dev.in
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 1955, in parseString
    raise exc
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 3814, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found '+'  (at char 3), (line:1, col:4)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 407, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 336, in generate_requires
    requirements.extend(packages,
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 143, in extend
    self.add(req_str, source=source)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 87, in add
    requirement = Requirement(requirement_str)
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'+https:/'": Expected stringEnd

rebased onto 5f91adaebe0ccbddeb9e4dec4f4042a7aa621640

2 years ago
Handling https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip from tox --print-deps-only: py310
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 1955, in parseString
    raise exc
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 3814, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found ':'  (at char 5), (line:1, col:6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 118, in add
    requirement = Requirement(requirement_str)
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'://githu'": Expected stringEnd

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 445, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 382, in generate_requires
    generate_tox_requirements(toxenv, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 337, in generate_tox_requirements
    requirements.extend(packages,
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 187, in extend
    self.add(req_str, source=source)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 130, in add
    raise InvalidRequirement(message)
packaging.requirements.InvalidRequirement: Requirement 'https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip' from tox --print-deps-only: py310 is invalid. Hint: It might be an URL. %pyproject_buildrequires cannot handle all URL-based requirements. Add #egg=PackageName to the URL to at least require any version of PackageName.

I will also most likely go back to raising ValueErrors as now it looks like the exception comes from packaging, which might be misleading.

rebased onto 7852c47d7352fe9bec2bbd822be35a5749f9a475

2 years ago
Handling https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip from tox --print-deps-only: py310
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 102, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 1955, in parseString
    raise exc
  File "/usr/lib/python3.10/site-packages/pyparsing.py", line 3814, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pyparsing.ParseException: Expected stringEnd, found ':'  (at char 5), (line:1, col:6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 118, in add
    requirement = Requirement(requirement_str)
  File "/usr/lib/python3.10/site-packages/packaging/requirements.py", line 104, in __init__
    raise InvalidRequirement(
packaging.requirements.InvalidRequirement: Parse error at "'://githu'": Expected stringEnd

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 445, in main
    generate_requires(
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 382, in generate_requires
    generate_tox_requirements(toxenv, requirements)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 337, in generate_tox_requirements
    requirements.extend(packages,
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 187, in extend
    self.add(req_str, source=source)
  File "/usr/lib/rpm/redhat/pyproject_buildrequires.py", line 130, in add
    raise ValueError(message)
ValueError: Requirement 'https://github.com/ActiveState/appdirs/archive/8eacfa312d77aba28d483fbfb6f6fc54099622be.zip' from tox --print-deps-only: py310 is invalid. Hint: It might be an URL. %pyproject_buildrequires cannot handle all URL-based requirements. Add #egg=PackageName to the URL to at least require any version of PackageName.
error: Bad exit status from /var/tmp/rpm-tmp.xPL0lu (%generate_buildrequires)
    Bad exit status from /var/tmp/rpm-tmp.xPL0lu (%generate_buildrequires)

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

rebased onto 4f673d0587bf26f81d2375b46e147dc420b69bbe

2 years ago

Build succeeded.

rebased onto 06a5f9e

2 years ago

Build succeeded.

I went through the changes you made here since yesterday, thank you. +1

1 new commit added

  • fixup! %pyproject_buildrequires now fails when it encounters an invalid requirement
2 years ago

Pushed another improvement as fixup, inspired by this change https://github.com/platformdirs/platformdirs/commit/a92dc71947ad96338fc292b474e4c5e8a3fb64c7 that changes the URL in platformdirs. Will cherry-pick the URL change for the Fedora package as well.

3 new commits added

  • fixup! %pyproject_buildrequires now fails when it encounters an invalid requirement
  • Rename %_pyproject_ghost_distinfo and %_pyproject_record to indicate they are private
  • %pyproject_buildrequires now fails when it encounters an invalid requirement
2 years ago

Build succeeded.

This PR adds two ways to specify requirements, a standard one and a pip-specific one.
However, the pip-specific one (#egg=) only works in in pip CLI and in requirements.txt which emulates it.

Pip and setuptools give errors when #egg= URLs are used in pyproject.toml or setup.py:

ERROR: file:///tmp/ggg has a pyproject.toml file that does not comply with PEP 518: 'build-system.requires' contains an invalid requirement: 'git+https://github.com/monty/spam.git@master#egg=spam'

error in test setup command: 'install_requires' must be a string or list of strings containing valid project/version requirement specifiers; Parse error at "'+https:/'": Expected stringEnd

Let's also be strict, and either not support #egg= or only support it in requirements.txt.

1 new commit added

  • fixup! %pyproject_buildrequires now fails when it encounters an invalid requirement
2 years ago

See the most recent fixup.

4 new commits added

  • fixup! %pyproject_buildrequires now fails when it encounters an invalid requirement
  • fixup! %pyproject_buildrequires now fails when it encounters an invalid requirement
  • Rename %_pyproject_ghost_distinfo and %_pyproject_record to indicate they are private
  • %pyproject_buildrequires now fails when it encounters an invalid requirement
2 years ago

I'm not happy with how requirements.txt hacks are becoming entangled with standards-based requirements parsing in pyproject-rpm-macros.
The PR looks good to me otherwise. If you merge it I can follow up with one for separating the requirements.txt handling.

Me neither. Id' rather incorporate your changes from the start. This can wait a ~week or so, there's no rush.

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

Build succeeded.

Pull-Request has been closed by churchyard

2 years ago