Commit d52e9fdd by Sébastien Eustace

Fix handling of extras in add command in some cases

parent e975b130
...@@ -425,6 +425,11 @@ The <c1>init</c1> command creates a basic <comment>pyproject.toml</> file in the ...@@ -425,6 +425,11 @@ The <c1>init</c1> command creates a basic <comment>pyproject.toml</> file in the
require = OrderedDict() require = OrderedDict()
if " " in pair: if " " in pair:
name, version = pair.split(" ", 2) name, version = pair.split(" ", 2)
extras_m = re.search(r"\[([\w\d,-_]+)\]$", name)
if extras_m:
extras = [e.strip() for e in extras_m.group(1).split(",")]
name, _ = name.split("[")
require["name"] = name require["name"] = name
if version != "latest": if version != "latest":
require["version"] = version require["version"] = version
......
...@@ -109,7 +109,7 @@ def test_add_constraint_with_extras(app, repo, installer): ...@@ -109,7 +109,7 @@ def test_add_constraint_with_extras(app, repo, installer):
repo.add_package(cachy1) repo.add_package(cachy1)
repo.add_package(get_package("msgpack-python", "0.5.3")) repo.add_package(get_package("msgpack-python", "0.5.3"))
tester.execute("cachy[msgpack]^0.1.0") tester.execute("cachy[msgpack]>=0.1.0,<0.2.0")
expected = """\ expected = """\
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment