Skip to content

Commit 7b1fd0c

Browse files
sdispaterbrandonautfinswimmerk4naredwardgeorge
authored
Merge master into develop (#2070)
* Fix Github actions cache issues (#1908) * Fix case of `-f` flag * Make it clearer what options to pass to `--format` * fix (masonry.api): `get_requires_for_build_wheel` must return additional list of requirements for building a package, not listed in `pyproject.toml` and not dependencies for the package itself (#1875) fix (tests): adopted tests * Lazy Keyring intialization for PasswordManager (#1892) * Fix Github Actions cache issues (#1928) * Avoid nested quantifiers with overlapping character space on git url parsing (#1902 (#1913) * fix (git): match for `\w` instead of `.` for getting user * change (vcs.git): hold pattern of the regex parts in a dictionary to be consistent over all regexs * new (vcs.git): test for `parse_url` and some fixes for the regex pattern * new (vcs.git): test for `parse_url` with string that should fail * fix (test.vcs.git): make flake8 happy * fix: correct parsing of wheel version with regex. (#1932) The previous regexp was only taking the first integer of the version number, this presented problems when the major version number reached double digits. Poetry would determine that the version of the dependency is '1', rather than, ie: '14'. This caused failures to solve versions. * Fix errors when using the --help option (#1910) * Fix how repository credentials are retrieved from env vars (#1909) # Conflicts: # poetry/utils/password_manager.py * Fix downloading packages from Simplepypi (#1851) * fix downloading packages from simplepypi * unused code removed * remove unused imports * Upgrade dependencies for the 1.0.3 release (#1965) * Bump version to 1.0.3 (#1966) * Fix non-compliant Git URL matching RFC 3986 § 2.3 permits more characters in a URL than were matched. This corrects that, though there may be other deficiencies. This was a regression from v1.0.2, where at least “.” was matched without error. * Update README.md "Updating Poetry" Currently the note in "Updating Poetry" is different from the one below in "Enable tab completion for Bash, Fish, or Zsh". This MR is to make them more consistent. * init: change dev dependency prompt * Fix CI issues (#2069) Co-authored-by: brandonaut <[email protected]> Co-authored-by: finswimmer <[email protected]> Co-authored-by: Yannick PÉROUX <[email protected]> Co-authored-by: Edward George <[email protected]> Co-authored-by: Jan Škoda <[email protected]> Co-authored-by: Andrew Marshall <[email protected]> Co-authored-by: Andrew Selzer <[email protected]> Co-authored-by: Andrii Maletskyi <[email protected]>
1 parent 4d05c15 commit 7b1fd0c

22 files changed

+477
-172
lines changed

.github/workflows/main.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
- name: Get full python version
3434
id: full-python-version
3535
run: |
36-
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")
36+
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
3737
- name: Install and set up Poetry
3838
run: |
3939
python get-poetry.py --preview -y
@@ -69,7 +69,7 @@ jobs:
6969
- name: Get full python version
7070
id: full-python-version
7171
run: |
72-
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")
72+
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
7373
- name: Install and set up Poetry
7474
run: |
7575
python get-poetry.py --preview -y
@@ -87,7 +87,7 @@ jobs:
8787
- name: Test
8888
run: |
8989
source $HOME/.poetry/env
90-
poetry run pytest -q tests
90+
.venv/bin/pytest -q tests
9191
9292
Windows:
9393
needs: Linting
@@ -106,7 +106,7 @@ jobs:
106106
id: full-python-version
107107
shell: bash
108108
run: |
109-
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")
109+
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
110110
- name: Install and setup Poetry
111111
run: |
112112
python get-poetry.py --preview -y

CHANGELOG.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
# Change Log
22

3+
## [1.0.3] - 2020-01-31
4+
5+
### Fixed
6+
7+
- Fixed an error which caused the configuration environment variables (like `POETRY_HTTP_BASIC_XXX_PASSWORD`) to not be used ([#1909](https://github.com/python-poetry/poetry/pull/1909)).
8+
- Fixed an error where the `--help` option was not working ([#1910](https://github.com/python-poetry/poetry/pull/1910)).
9+
- Fixed an error where packages from private indices were not decompressed properly ([#1851](https://github.com/python-poetry/poetry/pull/1851)).
10+
- Fixed an error where the version of some PEP-508-formatted wheel dependencies was not properly retrieved ([#1932](https://github.com/python-poetry/poetry/pull/1932)).
11+
- Fixed internal regexps to avoid potential catastrophic backtracking errors ([#1913](https://github.com/python-poetry/poetry/pull/1913)).
12+
- Fixed performance issues when custom indices were defined in the `pyproject.toml` file ([#1892](https://github.com/python-poetry/poetry/pull/1892)).
13+
- Fixed the `get_requires_for_build_wheel()` function of `masonry.api` which wasn't returning the proper result ([#1875](https://github.com/python-poetry/poetry/pull/1875)).
14+
15+
316
## [1.0.2] - 2020-01-10
417

518
### Fixed
@@ -783,7 +796,8 @@ Initial release
783796

784797

785798

786-
[Unreleased]: https://github.com/python-poetry/poetry/compare/1.0.2...master
799+
[Unreleased]: https://github.com/python-poetry/poetry/compare/1.0.3...master
800+
[1.0.3]: https://github.com/python-poetry/poetry/releases/tag/1.0.3
787801
[1.0.2]: https://github.com/python-poetry/poetry/releases/tag/1.0.2
788802
[1.0.1]: https://github.com/python-poetry/poetry/releases/tag/1.0.1
789803
[1.0.0]: https://github.com/python-poetry/poetry/releases/tag/1.0.0

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ to `self update`.
6565
poetry self update 1.0.0
6666
```
6767

68-
!!!note
68+
*Note:*
6969

7070
If you are still on poetry version < 1.0 use `poetry self:update` instead.
7171

docs/docs/cli.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Note that, at the moment, only pure python wheels are supported.
305305

306306
### Options
307307

308-
* `--format (-F)`: Limit the format to either wheel or sdist.
308+
* `--format (-f)`: Limit the format to either `wheel` or `sdist`.
309309

310310
## publish
311311

poetry.lock

+105-85
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

poetry/__version__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "1.0.2"
1+
__version__ = "1.0.3"

poetry/console/commands/init.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,7 @@ def handle(self):
165165
dev_requirements = {}
166166

167167
question = (
168-
"Would you like to define your dev dependencies"
169-
" (require-dev) interactively"
168+
"Would you like to define your development dependencies interactively?"
170169
)
171170
if self.confirm(question, True):
172171
if not help_displayed:

poetry/console/config/application_config.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
from clikit.api.event import PreHandleEvent
1010
from clikit.api.event import PreResolveEvent
1111
from clikit.api.event.event_dispatcher import EventDispatcher
12+
from clikit.api.exceptions import CliKitException
1213
from clikit.api.formatter import Style
1314
from clikit.api.io import Input
1415
from clikit.api.io import InputStream
@@ -101,7 +102,16 @@ def resolve_help_command(
101102
if args.has_option_token("-h") or args.has_option_token("--help"):
102103
from clikit.api.resolver import ResolvedCommand
103104

104-
resolved_command = self.command_resolver.resolve(args, application)
105+
try:
106+
resolved_command = self.command_resolver.resolve(args, application)
107+
except CliKitException:
108+
# We weren't able to resolve the command,
109+
# due to a parse error most likely,
110+
# so we fall back on the default behavior
111+
return super(ApplicationConfig, self).resolve_help_command(
112+
event, event_name, dispatcher
113+
)
114+
105115
# If the current command is the run one, skip option
106116
# check and interpret them as part of the executed command
107117
if resolved_command.command.name == "run":

poetry/masonry/api.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020

2121
def get_requires_for_build_wheel(config_settings=None):
2222
"""
23-
Returns a list of requirements for building, as strings
24-
"""
25-
poetry = Factory().create_poetry(Path("."))
23+
Returns an additional list of requirements for building, as PEP508 strings,
24+
above and beyond those specified in the pyproject.toml file.
2625
27-
main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires)
26+
This implementation is optional. At the moment it only returns an empty list, which would be the same as if
27+
not define. So this is just for completeness for future implementation.
28+
"""
2829

29-
return main
30+
return []
3031

3132

3233
# For now, we require all dependencies to build either a wheel or an sdist.

poetry/packages/__init__.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import re
33

44
from poetry.semver import Version
5+
from poetry.utils.patterns import wheel_file_re
56
from poetry.version.requirements import Requirement
67

78
from .dependency import Dependency
@@ -70,7 +71,7 @@ def dependency_from_pep_508(name):
7071
link = Link(path_to_url(os.path.normpath(os.path.abspath(link.path))))
7172
# wheel file
7273
if link.is_wheel:
73-
m = re.match(r"^(?P<namever>(?P<name>.+?)-(?P<ver>\d.*?))", link.filename)
74+
m = wheel_file_re.match(link.filename)
7475
if not m:
7576
raise ValueError("Invalid wheel name: {}".format(link.filename))
7677

poetry/utils/inspector.py

+1-9
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
import tarfile
44
import zipfile
55

6-
from bz2 import BZ2File
7-
from gzip import GzipFile
86
from typing import Dict
97
from typing import List
108
from typing import Union
@@ -114,27 +112,21 @@ def inspect_sdist(
114112
# Still not dependencies found
115113
# So, we unpack and introspect
116114
suffix = file_path.suffix
117-
gz = None
118115
if suffix == ".zip":
119116
tar = zipfile.ZipFile(str(file_path))
120117
else:
121118
if suffix == ".bz2":
122-
gz = BZ2File(str(file_path))
123119
suffixes = file_path.suffixes
124120
if len(suffixes) > 1 and suffixes[-2] == ".tar":
125121
suffix = ".tar.bz2"
126122
else:
127-
gz = GzipFile(str(file_path))
128123
suffix = ".tar.gz"
129124

130-
tar = tarfile.TarFile(str(file_path), fileobj=gz)
125+
tar = tarfile.open(str(file_path))
131126

132127
try:
133128
tar.extractall(os.path.join(str(file_path.parent), "unpacked"))
134129
finally:
135-
if gz:
136-
gz.close()
137-
138130
tar.close()
139131

140132
unpacked = file_path.parent / "unpacked"

poetry/utils/password_manager.py

+25-17
Original file line numberDiff line numberDiff line change
@@ -117,44 +117,52 @@ def _check(self):
117117
class PasswordManager:
118118
def __init__(self, config):
119119
self._config = config
120-
self._keyring = KeyRing("poetry-repository")
121-
if not self._keyring.is_available():
122-
logger.warning("Using a plaintext file to store and retrieve credentials")
120+
self._keyring = None
123121

124122
@property
125123
def keyring(self):
124+
if self._keyring is None:
125+
self._keyring = KeyRing("poetry-repository")
126+
if not self._keyring.is_available():
127+
logger.warning(
128+
"Using a plaintext file to store and retrieve credentials"
129+
)
130+
126131
return self._keyring
127132

128133
def set_pypi_token(self, name, token):
129-
if not self._keyring.is_available():
134+
if not self.keyring.is_available():
130135
self._config.auth_config_source.add_property(
131136
"pypi-token.{}".format(name), token
132137
)
133138
else:
134-
self._keyring.set_password(name, "__token__", token)
139+
self.keyring.set_password(name, "__token__", token)
135140

136141
def get_pypi_token(self, name):
137-
if not self._keyring.is_available():
142+
if not self.keyring.is_available():
138143
return self._config.get("pypi-token.{}".format(name))
139144

140-
return self._keyring.get_password(name, "__token__")
145+
return self.keyring.get_password(name, "__token__")
141146

142147
def delete_pypi_token(self, name):
143-
if not self._keyring.is_available():
148+
if not self.keyring.is_available():
144149
return self._config.auth_config_source.remove_property(
145150
"pypi-token.{}".format(name)
146151
)
147152

148-
self._keyring.delete_password(name, "__token__")
153+
self.keyring.delete_password(name, "__token__")
149154

150155
def get_http_auth(self, name):
151156
auth = self._config.get("http-basic.{}".format(name))
152157
if not auth:
153-
return None
154-
155-
username, password = auth["username"], auth.get("password")
156-
if password is None:
157-
password = self._keyring.get_password(name, username)
158+
username = self._config.get("http-basic.{}.username".format(name))
159+
password = self._config.get("http-basic.{}.password".format(name))
160+
if not username and not password:
161+
return None
162+
else:
163+
username, password = auth["username"], auth.get("password")
164+
if password is None:
165+
password = self.keyring.get_password(name, username)
158166

159167
return {
160168
"username": username,
@@ -164,10 +172,10 @@ def get_http_auth(self, name):
164172
def set_http_password(self, name, username, password):
165173
auth = {"username": username}
166174

167-
if not self._keyring.is_available():
175+
if not self.keyring.is_available():
168176
auth["password"] = password
169177
else:
170-
self._keyring.set_password(name, username, password)
178+
self.keyring.set_password(name, username, password)
171179

172180
self._config.auth_config_source.add_property("http-basic.{}".format(name), auth)
173181

@@ -177,7 +185,7 @@ def delete_http_password(self, name):
177185
return
178186

179187
try:
180-
self._keyring.delete_password(name, auth["username"])
188+
self.keyring.delete_password(name, auth["username"])
181189
except KeyRingError:
182190
pass
183191

0 commit comments

Comments
 (0)