Skip to content

Commit

Permalink
Merge branch 'main' into markdryan/manylinux-riscv64
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon authored Jan 17, 2024
2 parents 8c17ab6 + 4dce761 commit dfd83da
Show file tree
Hide file tree
Showing 15 changed files with 45 additions and 57 deletions.
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
groups:
github-actions:
patterns:
- "*"
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -47,9 +47,9 @@ jobs:

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
- name: Autobuild
uses: github/codeql-action/autobuild@v2
uses: github/codeql-action/autobuild@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@1500a131381b66de0c52ac28abb13cd79f4b7ecc # v2.22.12
with:
category: "/language:${{matrix.language}}"
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- uses: actions/setup-python@v4
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
name: Install Python
with:
python-version: "3.9"
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- uses: actions/setup-python@v4
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
name: Install Python
with:
python-version: "3.9"
Expand All @@ -43,13 +43,13 @@ jobs:
needs: lint

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- name: Build
run: pipx run build

- name: Archive files
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: dist
path: dist
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
["3.7", "3.8", "3.9", "3.10", "3.11", "3.12", "pypy3.8", "pypy3.9", "pypy3.10"]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0

- uses: actions/setup-python@v4
- uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
name: Install Python ${{ matrix.python_version }}
with:
python-version: ${{ matrix.python_version }}
Expand Down
2 changes: 1 addition & 1 deletion docs/development/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ The HTML documentation index can now be found at
.. _`virtualenv`: https://pypi.org/project/virtualenv/
.. _`pip`: https://pypi.org/project/pip/
.. _`sphinx`: https://pypi.org/project/Sphinx/
.. _`reStructured Text`: http://sphinx-doc.org/rest.html
.. _`reStructured Text`: https://www.sphinx-doc.org/en/master/usage/restructuredtext/
.. _`pre-commit`: https://pre-commit.com
2 changes: 1 addition & 1 deletion docs/development/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ bug check out `what to put in your bug report`_.
release-process

.. _`GitHub`: https://github.com/pypa/packaging
.. _`what to put in your bug report`: http://www.contribution-guide.org/#what-to-put-in-your-bug-report
.. _`what to put in your bug report`: https://www.contribution-guide.org/#what-to-put-in-your-bug-report
4 changes: 2 additions & 2 deletions docs/development/submitting-patches.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ So, specifically:
.. |black| replace:: ``black``
.. _black: https://pypi.org/project/black/
.. _`Write comments as complete sentences.`: https://nedbatchelder.com/blog/201401/comments_should_be_sentences.html
.. _`syntax`: http://sphinx-doc.org/domains.html#info-field-lists
.. _`Studies have shown`: http://www.ibm.com/developerworks/rational/library/11-proven-practices-for-peer-review/
.. _`syntax`: https://www.sphinx-doc.org/en/master/usage/restructuredtext/field-lists.html
.. _`Studies have shown`: https://www.microsoft.com/en-us/research/publication/characteristics-of-useful-code-reviews-an-empirical-study-at-microsoft/
4 changes: 2 additions & 2 deletions src/packaging/_manylinux.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def _glibc_version_string_confstr() -> Optional[str]:
# https://github.com/python/cpython/blob/fcf1d003bf4f0100c/Lib/platform.py#L175-L183
try:
# Should be a string like "glibc 2.17".
version_string: str = getattr(os, "confstr")("CS_GNU_LIBC_VERSION")
version_string: Optional[str] = os.confstr("CS_GNU_LIBC_VERSION")
assert version_string is not None
_, version = version_string.rsplit()
except (AssertionError, AttributeError, OSError, ValueError):
Expand Down Expand Up @@ -182,7 +182,7 @@ def _is_compatible(arch: str, version: _GLibCVersion) -> bool:
return False
# Check for presence of _manylinux module.
try:
import _manylinux # noqa
import _manylinux
except ImportError:
return True
if hasattr(_manylinux, "manylinux_compatible"):
Expand Down
5 changes: 1 addition & 4 deletions src/packaging/_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,7 @@ def _parse_marker_var(tokenizer: Tokenizer) -> MarkerVar:


def process_env_var(env_var: str) -> Variable:
if (
env_var == "platform_python_implementation"
or env_var == "python_implementation"
):
if env_var in ("platform_python_implementation", "python_implementation"):
return Variable("platform_python_implementation")
else:
return Variable(env_var)
Expand Down
2 changes: 1 addition & 1 deletion src/packaging/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def __init__(self, requirement_string: str) -> None:

self.name: str = parsed.name
self.url: Optional[str] = parsed.url or None
self.extras: Set[str] = set(parsed.extras if parsed.extras else [])
self.extras: Set[str] = set(parsed.extras or [])
self.specifier: SpecifierSet = SpecifierSet(parsed.specifier)
self.marker: Optional[Marker] = None
if parsed.marker is not None:
Expand Down
27 changes: 7 additions & 20 deletions src/packaging/specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,7 @@
import abc
import itertools
import re
from typing import (
Callable,
Iterable,
Iterator,
List,
Optional,
Set,
Tuple,
TypeVar,
Union,
)
from typing import Callable, Iterable, Iterator, List, Optional, Tuple, TypeVar, Union

from .utils import canonicalize_version
from .version import Version
Expand Down Expand Up @@ -697,7 +687,10 @@ def _pad_version(left: List[str], right: List[str]) -> Tuple[List[str], List[str
left_split.insert(1, ["0"] * max(0, len(right_split[0]) - len(left_split[0])))
right_split.insert(1, ["0"] * max(0, len(left_split[0]) - len(right_split[0])))

return (list(itertools.chain(*left_split)), list(itertools.chain(*right_split)))
return (
list(itertools.chain.from_iterable(left_split)),
list(itertools.chain.from_iterable(right_split)),
)


class SpecifierSet(BaseSpecifier):
Expand Down Expand Up @@ -729,14 +722,8 @@ def __init__(
# strip each item to remove leading/trailing whitespace.
split_specifiers = [s.strip() for s in specifiers.split(",") if s.strip()]

# Parsed each individual specifier, attempting first to make it a
# Specifier.
parsed: Set[Specifier] = set()
for specifier in split_specifiers:
parsed.add(Specifier(specifier))

# Turn our parsed specifiers into a frozen set and save them for later.
self._specs = frozenset(parsed)
# Make each individual specifier a Specifier and save in a frozen set for later.
self._specs = frozenset(map(Specifier, split_specifiers))

# Store our prereleases value so we can use it later to determine if
# we accept prereleases or not.
Expand Down
12 changes: 4 additions & 8 deletions tests/test_specifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,7 @@ def test_specifiers_hash(self, specifier):

@pytest.mark.parametrize(
("left", "right", "op"),
itertools.chain(
*
itertools.chain.from_iterable(
# Verify that the equal (==) operator works correctly
[[(x, x, operator.eq) for x in SPECIFIERS]]
+
Expand All @@ -260,8 +259,7 @@ def test_comparison_canonicalizes(self, left, right):

@pytest.mark.parametrize(
("left", "right", "op"),
itertools.chain(
*
itertools.chain.from_iterable(
# Verify that the equal (==) operator works correctly
[[(x, x, operator.ne) for x in SPECIFIERS]]
+
Expand Down Expand Up @@ -815,8 +813,7 @@ def test_specifiers_combine_not_implemented(self):

@pytest.mark.parametrize(
("left", "right", "op"),
itertools.chain(
*
itertools.chain.from_iterable(
# Verify that the equal (==) operator works correctly
[[(x, x, operator.eq) for x in SPECIFIERS]]
+
Expand All @@ -836,8 +833,7 @@ def test_comparison_true(self, left, right, op):

@pytest.mark.parametrize(
("left", "right", "op"),
itertools.chain(
*
itertools.chain.from_iterable(
# Verify that the equal (==) operator works correctly
[[(x, x, operator.ne) for x in SPECIFIERS]]
+
Expand Down
4 changes: 2 additions & 2 deletions tests/test_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@


def test_infinity_repr():
repr(Infinity) == "Infinity"
assert repr(Infinity) == "Infinity"


def test_negative_infinity_repr():
repr(NegativeInfinity) == "-Infinity"
assert repr(NegativeInfinity) == "-Infinity"


def test_infinity_hash():
Expand Down
6 changes: 2 additions & 4 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -667,8 +667,7 @@ def test_version_is_postrelease(self, version, expected):
("left", "right", "op"),
# Below we'll generate every possible combination of VERSIONS that
# should be True for the given operator
itertools.chain(
*
itertools.chain.from_iterable(
# Verify that the less than (<) operator works correctly
[
[(x, y, operator.lt) for y in VERSIONS[i + 1 :]]
Expand Down Expand Up @@ -710,8 +709,7 @@ def test_comparison_true(self, left, right, op):
("left", "right", "op"),
# Below we'll generate every possible combination of VERSIONS that
# should be False for the given operator
itertools.chain(
*
itertools.chain.from_iterable(
# Verify that the less than (<) operator works correctly
[
[(x, y, operator.lt) for y in VERSIONS[: i + 1]]
Expand Down

0 comments on commit dfd83da

Please sign in to comment.