Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-poetry-core for openSUSE:Factory checked in at 2021-09-26 21:48:17 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-poetry-core (Old) and /work/SRC/openSUSE:Factory/.python-poetry-core.new.1899 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-poetry-core" Sun Sep 26 21:48:17 2021 rev:4 rq:920855 version:1.0.6 Changes: -------- --- /work/SRC/openSUSE:Factory/python-poetry-core/python-poetry-core.changes 2021-04-18 21:44:53.708699995 +0200 +++ /work/SRC/openSUSE:Factory/.python-poetry-core.new.1899/python-poetry-core.changes 2021-09-26 21:48:53.446792703 +0200 @@ -1,0 +2,17 @@ +Wed Sep 22 09:47:36 UTC 2021 - Ben Greiner <c...@bnavigator.de> + +- Update to 1.0.6 + * Added support for more hash types gen generating hashes. (#207) +- Release 1.0.5 + * Fixed the copy of Package instances which led to file hashes + not being available. (#193) + * Fixed an issue where unsafe parameters could be passed to git + commands. (#203) + * Fixed an issue where the wrong git executable could be used on + Windows. (#205) +- Release 1.0.4 + * Fixed an error in the way python markers with a precision >= 3 + were handled. (#180) + * Fixed an error in the evaluation of in/not in markers (#189) + +------------------------------------------------------------------- Old: ---- poetry-core-1.0.3-gh.tar.gz New: ---- poetry-core-1.0.6-gh.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-poetry-core.spec ++++++ --- /var/tmp/diff_new_pack.qjns2m/_old 2021-09-26 21:48:53.934793247 +0200 +++ /var/tmp/diff_new_pack.qjns2m/_new 2021-09-26 21:48:53.934793247 +0200 @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-poetry-core -Version: 1.0.3 +Version: 1.0.6 Release: 0 Summary: Python poetry core utilities License: MIT ++++++ poetry-core-1.0.3-gh.tar.gz -> poetry-core-1.0.6-gh.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/.github/workflows/release.yml new/poetry-core-1.0.6/.github/workflows/release.yml --- old/poetry-core-1.0.3/.github/workflows/release.yml 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/.github/workflows/release.yml 2021-09-21 21:32:29.000000000 +0200 @@ -23,7 +23,7 @@ - name: Install and set up Poetry run: | curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py - python get-poetry.py --preview -y + python get-poetry.py -y - name: Build distributions run: | source $HOME/.poetry/env @@ -50,7 +50,7 @@ - name: Install and set up Poetry run: | curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py - python get-poetry.py --preview -y + python get-poetry.py -y - name: Build distributions run: | source $HOME/.poetry/env @@ -78,7 +78,7 @@ - name: Install and setup Poetry run: | Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py - python get-poetry.py --preview -y + python get-poetry.py -y - name: Build distributions run: | $env:Path += ";$env:Userprofile\.poetry\bin" @@ -108,7 +108,7 @@ - name: Install and set up Poetry run: | curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py - python get-poetry.py --preview -y + python get-poetry.py -y - name: Check distributions run: | ls -la dist diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/.github/workflows/tests.yml new/poetry-core-1.0.6/.github/workflows/tests.yml --- old/poetry-core-1.0.3/.github/workflows/tests.yml 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/.github/workflows/tests.yml 2021-09-21 21:32:29.000000000 +0200 @@ -41,7 +41,7 @@ shell: bash run: | curl -fsS -o get-poetry.py https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py - python get-poetry.py --preview -y + python get-poetry.py -y echo "$HOME/.poetry/bin" >> $GITHUB_PATH - name: Configure poetry diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/CHANGELOG.md new/poetry-core-1.0.6/CHANGELOG.md --- old/poetry-core-1.0.3/CHANGELOG.md 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/CHANGELOG.md 2021-09-21 21:32:29.000000000 +0200 @@ -1,5 +1,29 @@ # Change Log +## [1.0.6] - 2021-09-21 + +### Added + +- Added support for more hash types gen generating hashes. ([#207](https://github.com/python-poetry/poetry-core/pull/207)) + + +## [1.0.5] - 2021-09-18 + +### Fixed + +- Fixed the copy of `Package` instances which led to file hashes not being available. ([#193](https://github.com/python-poetry/poetry-core/pull/193)) +- Fixed an issue where unsafe parameters could be passed to `git` commands. ([#203](https://github.com/python-poetry/poetry-core/pull/203)) +- Fixed an issue where the wrong `git` executable could be used on Windows. ([#205](https://github.com/python-poetry/poetry-core/pull/205)) + + +## [1.0.4] - 2021-08-19 + +### Fixed + +- Fixed an error in the way python markers with a precision >= 3 were handled. ([#180](https://github.com/python-poetry/poetry-core/pull/180)) +- Fixed an error in the evaluation of `in/not in` markers ([#189](https://github.com/python-poetry/poetry-core/pull/189)) + + ## [1.0.3] - 2021-04-09 ### Fixed @@ -147,7 +171,10 @@ - Fixed support for stub-only packages ([#28](https://github.com/python-poetry/core/pull/28)). -[Unreleased]: https://github.com/python-poetry/poetry-core/compare/1.0.3...master +[Unreleased]: https://github.com/python-poetry/poetry-core/compare/1.0.6...1.1 +[1.0.6]: https://github.com/python-poetry/poetry-core/releases/tag/1.0.6 +[1.0.5]: https://github.com/python-poetry/poetry-core/releases/tag/1.0.5 +[1.0.4]: https://github.com/python-poetry/poetry-core/releases/tag/1.0.4 [1.0.3]: https://github.com/python-poetry/poetry-core/releases/tag/1.0.3 [1.0.2]: https://github.com/python-poetry/poetry-core/releases/tag/1.0.2 [1.0.1]: https://github.com/python-poetry/poetry-core/releases/tag/1.0.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/__init__.py new/poetry-core-1.0.6/poetry/core/__init__.py --- old/poetry-core-1.0.3/poetry/core/__init__.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/__init__.py 2021-09-21 21:32:29.000000000 +0200 @@ -7,7 +7,7 @@ # noinspection PyUnresolvedReferences from pathlib2 import Path -__version__ = "1.0.3" +__version__ = "1.0.6" __vendor_site__ = (Path(__file__).parent / "_vendor").as_posix() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/packages/constraints/base_constraint.py new/poetry-core-1.0.6/poetry/core/packages/constraints/base_constraint.py --- old/poetry-core-1.0.3/poetry/core/packages/constraints/base_constraint.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/packages/constraints/base_constraint.py 2021-09-21 21:32:29.000000000 +0200 @@ -6,6 +6,9 @@ class BaseConstraint(object): + def allows(self, other): # type: ("ConstraintTypes") -> bool + raise NotImplementedError + def allows_all(self, other): # type: ("ConstraintTypes") -> bool raise NotImplementedError() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/packages/constraints/empty_constraint.py new/poetry-core-1.0.6/poetry/core/packages/constraints/empty_constraint.py --- old/poetry-core-1.0.3/poetry/core/packages/constraints/empty_constraint.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/packages/constraints/empty_constraint.py 2021-09-21 21:32:29.000000000 +0200 @@ -17,6 +17,9 @@ def is_empty(self): # type: () -> bool return True + def allows(self, other): # type: ("ConstraintTypes") -> bool + return False + def allows_all(self, other): # type: ("ConstraintTypes") -> bool return True diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/packages/file_dependency.py new/poetry-core-1.0.6/poetry/core/packages/file_dependency.py --- old/poetry-core-1.0.3/poetry/core/packages/file_dependency.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/packages/file_dependency.py 2021-09-21 21:32:29.000000000 +0200 @@ -68,8 +68,8 @@ def is_file(self): # type: () -> bool return True - def hash(self): # type: () -> str - h = hashlib.sha256() + def hash(self, hash_name="sha256"): # type: (str) -> str + h = hashlib.new(hash_name) with self._full_path.open("rb") as fp: for content in iter(lambda: fp.read(io.DEFAULT_BUFFER_SIZE), b""): h.update(content) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/packages/package.py new/poetry-core-1.0.6/poetry/core/packages/package.py --- old/poetry-core-1.0.3/poetry/core/packages/package.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/packages/package.py 2021-09-21 21:32:29.000000000 +0200 @@ -405,33 +405,8 @@ return self.with_features([]) def clone(self): # type: () -> "Package" - if self.is_root(): - clone = self.__class__(self.pretty_name, self.version) - else: - clone = self.__class__( - self.pretty_name, - self.version, - source_type=self._source_type, - source_url=self._source_url, - source_reference=self._source_reference, - features=list(self.features), - ) - - clone.description = self.description - clone.category = self.category - clone.optional = self.optional - clone.python_versions = self.python_versions - clone.marker = self.marker - clone.extras = self.extras - clone.root_dir = self.root_dir - clone.develop = self.develop - - for dep in self.requires: - clone.requires.append(dep) - - for dep in self.dev_requires: - clone.dev_requires.append(dep) - + clone = self.__class__(self.pretty_name, self.version) + clone.__dict__ = copy.deepcopy(self.__dict__) return clone def __hash__(self): # type: () -> int diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/packages/utils/utils.py new/poetry-core-1.0.6/poetry/core/packages/utils/utils.py --- old/poetry-core-1.0.3/poetry/core/packages/utils/utils.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/packages/utils/utils.py 2021-09-21 21:32:29.000000000 +0200 @@ -244,6 +244,9 @@ marker = glue.join(parts) elif isinstance(constraint, Version): + if name == "python_version" and constraint.precision >= 3: + name = "python_full_version" + marker = '{} == "{}"'.format(name, constraint.text) else: if constraint.min is not None: @@ -251,9 +254,16 @@ if not constraint.include_min: op = ">" - version = constraint.min.text + version = constraint.min if constraint.max is not None: - text = '{} {} "{}"'.format(name, op, version) + min_name = max_name = name + if min_name == "python_version" and constraint.min.precision >= 3: + min_name = "python_full_version" + + if max_name == "python_version" and constraint.max.precision >= 3: + max_name = "python_full_version" + + text = '{} {} "{}"'.format(min_name, op, version) op = "<=" if not constraint.include_max: @@ -261,7 +271,7 @@ version = constraint.max - text += ' and {} {} "{}"'.format(name, op, version) + text += ' and {} {} "{}"'.format(max_name, op, version) return text elif constraint.max is not None: @@ -273,6 +283,9 @@ else: return "" + if name == "python_version" and version.precision >= 3: + name = "python_full_version" + marker = '{} {} "{}"'.format(name, op, version) return marker diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/vcs/git.py new/poetry-core-1.0.6/poetry/core/vcs/git.py --- old/poetry-core-1.0.3/poetry/core/vcs/git.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/vcs/git.py 2021-09-21 21:32:29.000000000 +0200 @@ -6,6 +6,8 @@ from typing import Any from typing import Optional +from poetry.core.utils._compat import PY36 +from poetry.core.utils._compat import WINDOWS from poetry.core.utils._compat import Path from poetry.core.utils._compat import decode @@ -92,6 +94,11 @@ ] +class GitError(RuntimeError): + + pass + + class ParsedUrl: def __init__( self, @@ -149,6 +156,47 @@ GitUrl = namedtuple("GitUrl", ["url", "revision"]) +_executable = None + + +def executable(): + global _executable + + if _executable is not None: + return _executable + + if WINDOWS and PY36: + # Finding git via where.exe + where = "%WINDIR%\\System32\\where.exe" + paths = decode( + subprocess.check_output([where, "git"], shell=True, encoding="oem") + ).split("\n") + for path in paths: + if not path: + continue + + path = Path(path.strip()) + try: + path.relative_to(Path.cwd()) + except ValueError: + _executable = str(path) + + break + else: + _executable = "git" + + if _executable is None: + raise RuntimeError("Unable to find a valid git executable") + + return _executable + + +def _reset_executable(): + global _executable + + _executable = None + + class GitConfig: def __init__(self, requires_git_presence=False): # type: (bool) -> None self._config = {} @@ -156,7 +204,7 @@ try: config_list = decode( subprocess.check_output( - ["git", "config", "-l"], stderr=subprocess.STDOUT + [executable(), "config", "-l"], stderr=subprocess.STDOUT ) ) @@ -209,7 +257,9 @@ return self._config def clone(self, repository, dest): # type: (str, Path) -> str - return self.run("clone", "--recurse-submodules", repository, str(dest)) + self._check_parameter(repository) + + return self.run("clone", "--recurse-submodules", "--", repository, str(dest)) def checkout(self, rev, folder=None): # type: (str, Optional[Path]) -> str args = [] @@ -224,6 +274,8 @@ folder.as_posix(), ] + self._check_parameter(rev) + args += ["checkout", rev] return self.run(*args) @@ -241,6 +293,8 @@ folder.as_posix(), ] + self._check_parameter(rev) + # We need "^0" (an alternative to "^{commit}") to ensure that the # commit SHA of the commit the tag points to is returned, even in # the case of annotated tags. @@ -299,5 +353,14 @@ ) + args return decode( - subprocess.check_output(["git"] + list(args), stderr=subprocess.STDOUT) + subprocess.check_output( + [executable()] + list(args), stderr=subprocess.STDOUT + ) ).strip() + + def _check_parameter(self, parameter): # type: (str) -> None + """ + Checks a git parameter to avoid unwanted code execution. + """ + if parameter.strip().startswith("-"): + raise GitError("Invalid Git parameter: {}".format(parameter)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/poetry/core/version/markers.py new/poetry-core-1.0.6/poetry/core/version/markers.py --- old/poetry-core-1.0.3/poetry/core/version/markers.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/poetry/core/version/markers.py 2021-09-21 21:32:29.000000000 +0200 @@ -225,7 +225,17 @@ else: self._constraint = self._parser(self._constraint_string) else: - self._constraint = self._parser(self._constraint_string) + # if we have a in/not in operator we split the constraint + # into a union/multi-constraint of single constraint + constraint_string = self._constraint_string + if self._operator in {"in", "not in"}: + op, glue = ("==", " || ") if self._operator == "in" else ("!=", ", ") + values = re.split("[ ,]+", self._value) + constraint_string = glue.join( + ("{} {}".format(op, value) for value in values) + ) + + self._constraint = self._parser(constraint_string) @property def name(self): # type: () -> str diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/pyproject.toml new/poetry-core-1.0.6/pyproject.toml --- old/poetry-core-1.0.3/pyproject.toml 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/pyproject.toml 2021-09-21 21:32:29.000000000 +0200 @@ -1,6 +1,6 @@ [tool.poetry] name = "poetry-core" -version = "1.0.3" +version = "1.0.6" description = "Poetry PEP 517 Build Backend" authors = ["S??bastien Eustace <sebast...@eustace.io>"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/tests/fixtures/sample_project/pyproject.toml new/poetry-core-1.0.6/tests/fixtures/sample_project/pyproject.toml --- old/poetry-core-1.0.3/tests/fixtures/sample_project/pyproject.toml 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/tests/fixtures/sample_project/pyproject.toml 2021-09-21 21:32:29.000000000 +0200 @@ -43,6 +43,9 @@ # Dependency with markers functools32 = { version = "^3.2.3", markers = "python_version ~= '2.7' and sys_platform == 'win32' or python_version in '3.4 3.5'" } +# Dependency with python constraint +dataclasses = {version = "^0.7", python = ">=3.6.1,<3.7"} + [tool.poetry.extras] db = [ "orator" ] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/tests/packages/test_file_dependency.py new/poetry-core-1.0.6/tests/packages/test_file_dependency.py --- old/poetry-core-1.0.3/tests/packages/test_file_dependency.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/tests/packages/test_file_dependency.py 2021-09-21 21:32:29.000000000 +0200 @@ -7,11 +7,12 @@ DIST_PATH = Path(__file__).parent.parent / "fixtures" / "distributions" +TEST_FILE = "demo-0.1.0.tar.gz" def test_file_dependency_wrong_path(): with pytest.raises(ValueError): - FileDependency("demo", DIST_PATH / "demo-0.2.0.tar.gz") + FileDependency("demo", DIST_PATH / TEST_FILE.replace("1", "2")) def test_file_dependency_dir(): @@ -19,6 +20,69 @@ FileDependency("demo", DIST_PATH) +def test_default_hash(): + path = DIST_PATH / TEST_FILE + dep = FileDependency("demo", path) + SHA_256 = "72e8531e49038c5f9c4a837b088bfcb8011f4a9f76335c8f0654df6ac539b3d6" + assert dep.hash() == SHA_256 + + +try: + from hashlib import algorithms_guaranteed as ALGORITHMS_GUARANTEED +except ImportError: + ALGORITHMS_GUARANTEED = "md5,sha1,sha224,sha256,sha384,sha512".split(",") + + +@pytest.mark.parametrize( + "hash_name,expected", + [ + (hash_name, value) + for hash_name, value in [ + ("sha224", "972d02f36539a98599aed0566bc8aaf3e6701f4e895dd797d8f5248e"), + ( + "sha3_512", + "c04ee109ae52d6440445e24dbd6d244a1d0f0289ef79cb7ba9bc3c139c0237169af9a8f61cd1cf4fc17f853ddf84f97c475ac5bb6c91a4aff0b825b884d4896c", + ), + ( + "blake2s", + "c336ecbc9d867c9d860accfba4c3723c51c4b5c47a1e0a955e1c8df499e36741", + ), + ( + "sha3_384", + "d4abb2459941369aabf8880c5287b7eeb80678e14f13c71b9ecf64c772029dc3f93939590bea9ecdb51a1d1a74fefc5a", + ), + ( + "blake2b", + "48e70abac547ab38e2330e6e6743a0c0f6274dcaa6df2c98135a78a9dd5b04a072d551fc3851b34da03eb0bf50dd71c7f32a8c36956e99fd6c66491bc7844800", + ), + ( + "sha256", + "72e8531e49038c5f9c4a837b088bfcb8011f4a9f76335c8f0654df6ac539b3d6", + ), + ( + "sha512", + "e08a00a4b86358e49a318e7e3ba7a3d2fabdd17a2fef95559a0af681ea07ab1296b0b8e11e645297da296290661dc07ae3c8f74eab66bd18a80dce0c0ccb355b", + ), + ( + "sha384", + "aa3144e28c6700a83247e8ec8711af5d3f5f75997990d48ec41e66bd275b3d0e19ee6f2fe525a358f874aa717afd06a9", + ), + ("sha3_224", "64bfc6e4125b4c6d67fd88ad1c7d1b5c4dc11a1970e433cd576c91d4"), + ("sha1", "4c057579005ac3e68e951a11ffdc4b27c6ae16af"), + ( + "sha3_256", + "ba3d2a964b0680b6dc9565a03952e29c294c785d5a2307d3e2d785d73b75ed7e", + ), + ] + if hash_name in ALGORITHMS_GUARANTEED + ], +) +def test_guaranteed_hash(hash_name, expected): + path = DIST_PATH / TEST_FILE + dep = FileDependency("demo", path) + assert dep.hash(hash_name) == expected + + def _test_file_dependency_pep_508( mocker, name, path, pep_508_input, pep_508_output=None ): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/tests/packages/test_package.py new/poetry-core-1.0.6/tests/packages/test_package.py --- old/poetry-core-1.0.3/tests/packages/test_package.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/tests/packages/test_package.py 2021-09-21 21:32:29.000000000 +0200 @@ -280,3 +280,29 @@ assert "https://example.com/path.tar.gz" == dep.url assert "url" == dep.source_type assert "https://example.com/path.tar.gz" == dep.source_url + + +def test_package_clone(f): + # TODO(nic): this test is not future-proof, in that any attributes added + # to the Package object and not filled out in this test setup might + # cause comparisons to match that otherwise should not. A factory method + # to create a Package object with all fields fully randomized would be the + # most rigorous test for this, but that's likely overkill. + p = Package( + "lol_wut", + "3.141.5926535", + pretty_version="???.???.???", + source_type="git", + source_url="http://some.url", + source_reference="fe4d2adabf3feb5d32b70ab5c105285fa713b10c", + source_resolved_reference="fe4d2adabf3feb5d32b70ab5c105285fa713b10c", + features=["abc", "def"], + ) + p.files = (["file1", "file2", "file3"],) + p.homepage = "https://some.other.url" + p.repository_url = "http://bug.farm" + p.documentation_url = "http://lorem.ipsum/dolor/sit.amet" + p2 = p.clone() + + assert p == p2 + assert p.__dict__ == p2.__dict__ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/tests/test_factory.py new/poetry-core-1.0.6/tests/test_factory.py --- old/poetry-core-1.0.3/tests/test_factory.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/tests/test_factory.py 2021-09-21 21:32:29.000000000 +0200 @@ -100,6 +100,15 @@ == 'python_version ~= "2.7" and sys_platform == "win32" or python_version in "3.4 3.5"' ) + dataclasses = dependencies["dataclasses"] + assert dataclasses.name == "dataclasses" + assert dataclasses.pretty_constraint == "^0.7" + assert dataclasses.python_versions == ">=3.6.1,<3.7" + assert ( + str(dataclasses.marker) + == 'python_full_version >= "3.6.1" and python_version < "3.7"' + ) + assert "db" in package.extras classifiers = package.classifiers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/tests/vcs/test_vcs.py new/poetry-core-1.0.6/tests/vcs/test_vcs.py --- old/poetry-core-1.0.3/tests/vcs/test_vcs.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/tests/vcs/test_vcs.py 2021-09-21 21:32:29.000000000 +0200 @@ -1,8 +1,15 @@ +import subprocess + import pytest +from poetry.core.utils._compat import PY36 +from poetry.core.utils._compat import WINDOWS +from poetry.core.utils._compat import Path from poetry.core.vcs.git import Git +from poetry.core.vcs.git import GitError from poetry.core.vcs.git import GitUrl from poetry.core.vcs.git import ParsedUrl +from poetry.core.vcs.git import _reset_executable @pytest.mark.parametrize( @@ -259,3 +266,58 @@ with pytest.raises(ValueError): ParsedUrl.parse(url) + + +def test_git_clone_raises_error_on_invalid_repository(): + with pytest.raises(GitError): + Git().clone("-u./payload", Path("foo")) + + +def test_git_checkout_raises_error_on_invalid_repository(): + with pytest.raises(GitError): + Git().checkout("-u./payload") + + +def test_git_rev_parse_raises_error_on_invalid_repository(): + with pytest.raises(GitError): + Git().rev_parse("-u./payload") + + +@pytest.mark.skipif( + not WINDOWS or not PY36, + reason="Retrieving the complete path to git is only necessary on Windows, for security reasons", +) +def test_ensure_absolute_path_to_git(mocker): + _reset_executable() + + def checkout_output(cmd, *args, **kwargs): + if Path(cmd[0]).name == "where.exe": + return "\n".join( + [str(Path.cwd().joinpath("git.exe")), "C:\\Git\\cmd\\git.exe"] + ) + + return b"" + + mock = mocker.patch.object(subprocess, "check_output", side_effect=checkout_output) + + Git().run("config") + + assert mock.call_args_list[-1][0][0] == [ + "C:\\Git\\cmd\\git.exe", + "config", + ] + + +@pytest.mark.skipif( + not WINDOWS or not PY36, + reason="Retrieving the complete path to git is only necessary on Windows, for security reasons", +) +def test_ensure_existing_git_executable_is_found(mocker): + mock = mocker.patch.object(subprocess, "check_output", return_value=b"") + + Git().run("config") + + cmd = Path(mock.call_args_list[-1][0][0][0]) + + assert cmd.is_absolute() + assert cmd.name == "git.exe" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/poetry-core-1.0.3/tests/version/test_markers.py new/poetry-core-1.0.6/tests/version/test_markers.py --- old/poetry-core-1.0.3/tests/version/test_markers.py 2021-04-09 17:32:24.000000000 +0200 +++ new/poetry-core-1.0.6/tests/version/test_markers.py 2021-09-21 21:32:29.000000000 +0200 @@ -36,6 +36,34 @@ assert m.constraint_string == "not in 2.7, 3.0, 3.1" assert str(m.constraint) == "<2.7.0 || >=2.8.0,<3.0.0 || >=3.2.0" + m = parse_marker( + "platform_machine in 'x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32'" + ) + + assert isinstance(m, SingleMarker) + assert m.name == "platform_machine" + assert ( + m.constraint_string + == "in x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32" + ) + assert str(m.constraint) == ( + "x86_64 || X86_64 || aarch64 || AARCH64 || ppc64le || PPC64LE || amd64 || AMD64 || win32 || WIN32" + ) + + m = parse_marker( + "platform_machine not in 'x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32'" + ) + + assert isinstance(m, SingleMarker) + assert m.name == "platform_machine" + assert ( + m.constraint_string + == "not in x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32" + ) + assert str(m.constraint) == ( + "!=x86_64, !=X86_64, !=aarch64, !=AARCH64, !=ppc64le, !=PPC64LE, !=amd64, !=AMD64, !=win32, !=WIN32" + ) + def test_single_marker_intersect(): m = parse_marker('sys_platform == "darwin"') @@ -476,6 +504,26 @@ {"python_version": "2.7"}, False, ), + ( + "platform_machine in 'x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32'", + {"platform_machine": "foo"}, + False, + ), + ( + "platform_machine in 'x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32'", + {"platform_machine": "x86_64"}, + True, + ), + ( + "platform_machine not in 'x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32'", + {"platform_machine": "foo"}, + True, + ), + ( + "platform_machine not in 'x86_64 X86_64 aarch64 AARCH64 ppc64le PPC64LE amd64 AMD64 win32 WIN32'", + {"platform_machine": "x86_64"}, + False, + ), ], ) def test_validate(marker_string, environment, expected):