Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge master into develop #2070

Merged
merged 22 commits into from
Feb 21, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
5c30345
Fix Github actions cache issues (#1908)
sdispater Jan 17, 2020
3a2739e
Fix case of `-f` flag
brandonaut Jan 18, 2020
3d61e2a
Make it clearer what options to pass to `--format`
brandonaut Jan 18, 2020
22f06e5
Merge pull request #1914 from brandonaut/fix-build-doc
finswimmer Jan 18, 2020
a0c9357
fix (masonry.api): `get_requires_for_build_wheel` must return additio…
finswimmer Jan 20, 2020
380e09b
Lazy Keyring intialization for PasswordManager (#1892)
k4nar Jan 20, 2020
954d160
Fix Github Actions cache issues (#1928)
sdispater Jan 21, 2020
2df0d2c
Avoid nested quantifiers with overlapping character space on git url …
finswimmer Jan 22, 2020
930515b
fix: correct parsing of wheel version with regex. (#1932)
edwardgeorge Jan 22, 2020
4897a70
Fix errors when using the --help option (#1910)
sdispater Jan 31, 2020
4687ef8
Fix how repository credentials are retrieved from env vars (#1909)
sdispater Jan 31, 2020
d331535
Fix downloading packages from Simplepypi (#1851)
leftys Jan 31, 2020
7974d0f
Upgrade dependencies for the 1.0.3 release (#1965)
sdispater Jan 31, 2020
ed44342
Bump version to 1.0.3 (#1966)
sdispater Jan 31, 2020
7348893
Fix non-compliant Git URL matching
amarshall Feb 11, 2020
7d5934e
Merge pull request #2018 from amarshall/fix-git-url-pattern
finswimmer Feb 11, 2020
8fa1915
Update README.md "Updating Poetry"
afs2015 Feb 14, 2020
b3b07cb
Merge pull request #2040 from afs2015/patch-1
finswimmer Feb 15, 2020
03db001
init: change dev dependency prompt
and800 Oct 30, 2019
12db4a5
Merge pull request #1519 from and800/master
finswimmer Feb 17, 2020
960dc06
Fix CI issues (#2069)
sdispater Feb 21, 2020
333419a
Merge branch 'master' into merge-master-into-develop
sdispater Feb 21, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Get full python version
id: full-python-version
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Install and set up Poetry
run: |
python get-poetry.py --preview -y
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
- name: Get full python version
id: full-python-version
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Install and set up Poetry
run: |
python get-poetry.py --preview -y
Expand All @@ -87,7 +87,7 @@ jobs:
- name: Test
run: |
source $HOME/.poetry/env
poetry run pytest -q tests
.venv/bin/pytest -q tests

Windows:
needs: Linting
Expand All @@ -106,7 +106,7 @@ jobs:
id: full-python-version
shell: bash
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info[:3]))")
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
- name: Install and setup Poetry
run: |
python get-poetry.py --preview -y
Expand Down
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Change Log

## [1.0.3] - 2020-01-31

### Fixed

- 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)).
- Fixed an error where the `--help` option was not working ([#1910](https://github.com/python-poetry/poetry/pull/1910)).
- Fixed an error where packages from private indices were not decompressed properly ([#1851](https://github.com/python-poetry/poetry/pull/1851)).
- 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)).
- Fixed internal regexps to avoid potential catastrophic backtracking errors ([#1913](https://github.com/python-poetry/poetry/pull/1913)).
- Fixed performance issues when custom indices were defined in the `pyproject.toml` file ([#1892](https://github.com/python-poetry/poetry/pull/1892)).
- 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)).


## [1.0.2] - 2020-01-10

### Fixed
Expand Down Expand Up @@ -783,7 +796,8 @@ Initial release



[Unreleased]: https://github.com/python-poetry/poetry/compare/1.0.2...master
[Unreleased]: https://github.com/python-poetry/poetry/compare/1.0.3...master
[1.0.3]: https://github.com/python-poetry/poetry/releases/tag/1.0.3
[1.0.2]: https://github.com/python-poetry/poetry/releases/tag/1.0.2
[1.0.1]: https://github.com/python-poetry/poetry/releases/tag/1.0.1
[1.0.0]: https://github.com/python-poetry/poetry/releases/tag/1.0.0
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ to `self update`.
poetry self update 1.0.0
```

!!!note
*Note:*

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

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ Note that, at the moment, only pure python wheels are supported.

### Options

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

## publish

Expand Down
190 changes: 105 additions & 85 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion poetry/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.0.2"
__version__ = "1.0.3"
3 changes: 1 addition & 2 deletions poetry/console/commands/init.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,7 @@ def handle(self):
dev_requirements = {}

question = (
"Would you like to define your dev dependencies"
" (require-dev) interactively"
"Would you like to define your development dependencies interactively?"
)
if self.confirm(question, True):
if not help_displayed:
Expand Down
12 changes: 11 additions & 1 deletion poetry/console/config/application_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from clikit.api.event import PreHandleEvent
from clikit.api.event import PreResolveEvent
from clikit.api.event.event_dispatcher import EventDispatcher
from clikit.api.exceptions import CliKitException
from clikit.api.formatter import Style
from clikit.api.io import Input
from clikit.api.io import InputStream
Expand Down Expand Up @@ -101,7 +102,16 @@ def resolve_help_command(
if args.has_option_token("-h") or args.has_option_token("--help"):
from clikit.api.resolver import ResolvedCommand

resolved_command = self.command_resolver.resolve(args, application)
try:
resolved_command = self.command_resolver.resolve(args, application)
except CliKitException:
# We weren't able to resolve the command,
# due to a parse error most likely,
# so we fall back on the default behavior
return super(ApplicationConfig, self).resolve_help_command(
event, event_name, dispatcher
)

# If the current command is the run one, skip option
# check and interpret them as part of the executed command
if resolved_command.command.name == "run":
Expand Down
11 changes: 6 additions & 5 deletions poetry/masonry/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@

def get_requires_for_build_wheel(config_settings=None):
"""
Returns a list of requirements for building, as strings
"""
poetry = Factory().create_poetry(Path("."))
Returns an additional list of requirements for building, as PEP508 strings,
above and beyond those specified in the pyproject.toml file.

main, _ = SdistBuilder.convert_dependencies(poetry.package, poetry.package.requires)
This implementation is optional. At the moment it only returns an empty list, which would be the same as if
not define. So this is just for completeness for future implementation.
"""

return main
return []


# For now, we require all dependencies to build either a wheel or an sdist.
Expand Down
3 changes: 2 additions & 1 deletion poetry/packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import re

from poetry.semver import Version
from poetry.utils.patterns import wheel_file_re
from poetry.version.requirements import Requirement

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

Expand Down
10 changes: 1 addition & 9 deletions poetry/utils/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import tarfile
import zipfile

from bz2 import BZ2File
from gzip import GzipFile
from typing import Dict
from typing import List
from typing import Union
Expand Down Expand Up @@ -114,27 +112,21 @@ def inspect_sdist(
# Still not dependencies found
# So, we unpack and introspect
suffix = file_path.suffix
gz = None
if suffix == ".zip":
tar = zipfile.ZipFile(str(file_path))
else:
if suffix == ".bz2":
gz = BZ2File(str(file_path))
suffixes = file_path.suffixes
if len(suffixes) > 1 and suffixes[-2] == ".tar":
suffix = ".tar.bz2"
else:
gz = GzipFile(str(file_path))
suffix = ".tar.gz"

tar = tarfile.TarFile(str(file_path), fileobj=gz)
tar = tarfile.open(str(file_path))

try:
tar.extractall(os.path.join(str(file_path.parent), "unpacked"))
finally:
if gz:
gz.close()

tar.close()

unpacked = file_path.parent / "unpacked"
Expand Down
42 changes: 25 additions & 17 deletions poetry/utils/password_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,44 +117,52 @@ def _check(self):
class PasswordManager:
def __init__(self, config):
self._config = config
self._keyring = KeyRing("poetry-repository")
if not self._keyring.is_available():
logger.warning("Using a plaintext file to store and retrieve credentials")
self._keyring = None

@property
def keyring(self):
if self._keyring is None:
self._keyring = KeyRing("poetry-repository")
if not self._keyring.is_available():
logger.warning(
"Using a plaintext file to store and retrieve credentials"
)

return self._keyring

def set_pypi_token(self, name, token):
if not self._keyring.is_available():
if not self.keyring.is_available():
self._config.auth_config_source.add_property(
"pypi-token.{}".format(name), token
)
else:
self._keyring.set_password(name, "__token__", token)
self.keyring.set_password(name, "__token__", token)

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

return self._keyring.get_password(name, "__token__")
return self.keyring.get_password(name, "__token__")

def delete_pypi_token(self, name):
if not self._keyring.is_available():
if not self.keyring.is_available():
return self._config.auth_config_source.remove_property(
"pypi-token.{}".format(name)
)

self._keyring.delete_password(name, "__token__")
self.keyring.delete_password(name, "__token__")

def get_http_auth(self, name):
auth = self._config.get("http-basic.{}".format(name))
if not auth:
return None

username, password = auth["username"], auth.get("password")
if password is None:
password = self._keyring.get_password(name, username)
username = self._config.get("http-basic.{}.username".format(name))
password = self._config.get("http-basic.{}.password".format(name))
if not username and not password:
return None
else:
username, password = auth["username"], auth.get("password")
if password is None:
password = self.keyring.get_password(name, username)

return {
"username": username,
Expand All @@ -164,10 +172,10 @@ def get_http_auth(self, name):
def set_http_password(self, name, username, password):
auth = {"username": username}

if not self._keyring.is_available():
if not self.keyring.is_available():
auth["password"] = password
else:
self._keyring.set_password(name, username, password)
self.keyring.set_password(name, username, password)

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

Expand All @@ -177,7 +185,7 @@ def delete_http_password(self, name):
return

try:
self._keyring.delete_password(name, auth["username"])
self.keyring.delete_password(name, auth["username"])
except KeyRingError:
pass

Expand Down
Loading