Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
python-poetry
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
open
python-poetry
Commits
27d6fcf7
Unverified
Commit
27d6fcf7
authored
Jan 13, 2019
by
Sébastien Eustace
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix exclude functionality on case sensitive systems
#764
parent
2949e15c
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
202 additions
and
4 deletions
+202
-4
CHANGELOG.md
+1
-0
poetry.lock
+11
-1
poetry/masonry/builders/builder.py
+8
-2
poetry/utils/_compat.py
+5
-1
pyproject.toml
+2
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/LICENSE
+20
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/README.rst
+2
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/Bar.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/IncludedBar.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/SecondBar.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/lowercasebar.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/Bar.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/lowercasebar.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/__init__.py
+1
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/CapitalFoo.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/foo.py
+0
-0
tests/masonry/builders/fixtures/case_sensitive_exclusions/pyproject.toml
+49
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/LICENSE
+20
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/README.rst
+2
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Bar/foo/bar/Foo.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/Bar.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/IncludedBar.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/SecondBar.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/lowercasebar.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/Bar.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/lowercasebar.py
+0
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/__init__.py
+1
-0
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/pyproject.toml
+44
-0
tests/masonry/builders/test_builder.py
+36
-0
No files found.
CHANGELOG.md
View file @
27d6fcf7
...
...
@@ -10,6 +10,7 @@
-
Fixed an error when locking packages with no description.
-
Fixed path resolution for transitive file dependencies.
-
Fixed multiple constraints handling for the root package.
-
Fixed exclude functionality on case sensitive systems.
## [0.12.10] - 2018-11-22
...
...
poetry.lock
View file @
27d6fcf7
...
...
@@ -189,6 +189,15 @@ version = "3.2.3-2"
[[package]]
category = "main"
description = "Version of the glob module that can capture patterns and supports recursive wildcards"
marker = "python_version >= \"2.7\" and python_version < \"2.8\" or python_version >= \"3.4\" and python_version < \"3.5\""
name = "glob2"
optional = false
python-versions = "*"
version = "0.6"
[[package]]
category = "main"
description = "HTML parser based on the WHATWG HTML specification"
name = "html5lib"
optional = false
...
...
@@ -750,7 +759,7 @@ python-versions = "*"
version = "0.5.1"
[metadata]
content-hash = "
cc0af5d7cff3183d13e844efc25bfabc912de0a22eea948614a0895ab4be5ed1
"
content-hash = "
b42091ed7cc94500aeacca996b2c371c0d610c36e0ba61209e78f8532b56fcd9
"
python-versions = "~2.7 || ^3.4"
[metadata.hashes]
...
...
@@ -774,6 +783,7 @@ enum34 = ["2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850", "6
filelock = ["b8d5ca5ca1c815e1574aee746650ea7301de63d87935b3463d26368b76e31633", "d610c1bb404daf85976d7a82eb2ada120f04671007266b708606565dd03b5be6"]
funcsigs = ["330cc27ccbf7f1e992e69fef78261dc7c6569012cf397db8d3de0234e6c937ca", "a7bb0f2cf3a3fd1ab2732cb49eba4252c2af4240442415b4abce3b87022a8f50"]
functools32 = ["89d824aa6c358c421a234d7f9ee0bd75933a67c29588ce50aaa3acdf4d403fa0", "f6253dfbe0538ad2e387bd8fdfd9293c925d63553f5813c4e587745416501e6d"]
glob2 = ["f5b0a686ff21f820c4d3f0c4edd216704cea59d79d00fa337e244a2f2ff83ed6"]
html5lib = ["20b159aa3badc9d5ee8f5c647e5efd02ed2a66ab8d354930bd9ff139fc1dc0a3", "66cb0dcfdbbc4f9c3ba1a63fdb511ffdbd4f513b2b6d81b80cd26ce6b3fb3736"]
identify = ["5e956558a9a1e3b3891d7c6609fc9709657a11878af288ace484d1a46a93922b", "623086059219cc7b86c77a3891f3700cb175d4ce02b8fb8802b047301d71e783"]
idna = ["156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e", "684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"]
...
...
poetry/masonry/builders/builder.py
View file @
27d6fcf7
# -*- coding: utf-8 -*-
import
os
import
re
import
shutil
import
tempfile
...
...
@@ -10,6 +11,7 @@ from typing import Union
from
poetry.utils._compat
import
Path
from
poetry.utils._compat
import
basestring
from
poetry.utils._compat
import
glob
from
poetry.utils._compat
import
lru_cache
from
poetry.vcs
import
get_vcs
...
...
@@ -53,8 +55,12 @@ class Builder(object):
explicitely_excluded
=
set
()
for
excluded_glob
in
self
.
_package
.
exclude
:
for
excluded
in
self
.
_path
.
glob
(
str
(
excluded_glob
)):
explicitely_excluded
.
add
(
excluded
.
relative_to
(
self
.
_path
)
.
as_posix
())
for
excluded
in
glob
(
os
.
path
.
join
(
self
.
_path
.
as_posix
(),
str
(
excluded_glob
)),
recursive
=
True
):
explicitely_excluded
.
add
(
Path
(
excluded
)
.
relative_to
(
self
.
_path
)
.
as_posix
()
)
ignored
=
vcs_ignored_files
|
explicitely_excluded
result
=
set
()
...
...
poetry/utils/_compat.py
View file @
27d6fcf7
import
subprocess
import
sys
try
:
...
...
@@ -7,6 +6,11 @@ except ImportError:
from
functools
import
lru_cache
try
:
from
glob2
import
glob
except
ImportError
:
from
glob
import
glob
try
:
import
urllib.parse
as
urlparse
except
ImportError
:
import
urlparse
...
...
pyproject.toml
View file @
27d6fcf7
...
...
@@ -41,6 +41,8 @@ typing = { version = "^3.6", python = "~2.7 || ~3.4" }
# Use pathlib2 for Python 2.7 and 3.4
pathlib2
=
{
version
=
"^2.3"
,
python
=
"~2.7 || ~3.4"
}
# Use glob2 for Python 2.7 and 3.4
glob2
=
{
version
=
"^0.6"
,
python
=
"~2.7 || ~3.4"
}
# Use virtualenv for Python 2.7 since venv does not exist
virtualenv
=
{
version
=
"^16.0"
,
python
=
"~2.7"
}
# functools32 is needed for Python 2.7
...
...
tests/masonry/builders/fixtures/case_sensitive_exclusions/LICENSE
0 → 100644
View file @
27d6fcf7
Copyright (c) 2018 Sébastien Eustace
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tests/masonry/builders/fixtures/case_sensitive_exclusions/README.rst
0 → 100644
View file @
27d6fcf7
My Package
==========
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/Bar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/IncludedBar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/SecondBar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/Foo/lowercasebar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/Bar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/FooBar/lowercasebar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/__init__.py
0 → 100644
View file @
27d6fcf7
__version__
=
"1.2.3"
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/CapitalFoo.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/my_package/bar/foo.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/case_sensitive_exclusions/pyproject.toml
0 → 100644
View file @
27d6fcf7
[tool.poetry]
name
=
"my-package"
version
=
"1.2.3"
description
=
"Some description."
authors
=
[
"Sébastien Eustace <sebastien@eustace.io>"
]
license
=
"MIT"
readme
=
"README.rst"
homepage
=
"https://poetry.eustace.io/"
repository
=
"https://github.com/sdispater/poetry"
documentation
=
"https://poetry.eustace.io/docs"
keywords
=
[
"packaging"
,
"dependency"
,
"poetry"
]
classifiers
=
[
"Topic :: Software Development :: Build Tools"
,
"Topic :: Software Development :: Libraries :: Python Modules"
]
exclude
=
[
"**/SecondBar.py"
,
"my_package/FooBar/*"
,
"my_package/Foo/Bar.py"
,
"my_package/Foo/lowercasebar.py"
,
"my_package/bar/foo.py"
,
"my_package/bar/CapitalFoo.py"
]
# Requirements
[tool.poetry.dependencies]
python
=
"^3.6"
cleo
=
"^0.6"
cachy
=
{
version
=
"^0.2.0"
,
extras
=
["msgpack"]
}
pendulum
=
{
version
=
"^1.4"
,
optional
=
true
}
[tool.poetry.dev-dependencies]
pytest
=
"~3.4"
[tool.poetry.extras]
time
=
["pendulum"]
[tool.poetry.scripts]
my-script
=
"my_package:main"
my-2nd-script
=
"my_package:main2"
extra-script
=
{callable
=
"my_package.extra:main"
,
extras
=
["time"]
}
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/LICENSE
0 → 100644
View file @
27d6fcf7
Copyright (c) 2018 Sébastien Eustace
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/README.rst
0 → 100644
View file @
27d6fcf7
My Package
==========
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Bar/foo/bar/Foo.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/Bar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/IncludedBar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/SecondBar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/Foo/lowercasebar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/Bar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/FooBar/lowercasebar.py
0 → 100644
View file @
27d6fcf7
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/my_package/__init__.py
0 → 100644
View file @
27d6fcf7
__version__
=
"1.2.3"
tests/masonry/builders/fixtures/invalid_case_sensitive_exclusions/pyproject.toml
0 → 100644
View file @
27d6fcf7
[tool.poetry]
name
=
"my-package"
version
=
"1.2.3"
description
=
"Some description."
authors
=
[
"Sébastien Eustace <sebastien@eustace.io>"
]
license
=
"MIT"
readme
=
"README.rst"
homepage
=
"https://poetry.eustace.io/"
repository
=
"https://github.com/sdispater/poetry"
documentation
=
"https://poetry.eustace.io/docs"
keywords
=
[
"packaging"
,
"dependency"
,
"poetry"
]
classifiers
=
[
"Topic :: Software Development :: Build Tools"
,
"Topic :: Software Development :: Libraries :: Python Modules"
]
exclude
=
[
"my_package/Bar/*/bar/*.py"
]
# Requirements
[tool.poetry.dependencies]
python
=
"^3.6"
cleo
=
"^0.6"
cachy
=
{
version
=
"^0.2.0"
,
extras
=
["msgpack"]
}
pendulum
=
{
version
=
"^1.4"
,
optional
=
true
}
[tool.poetry.dev-dependencies]
pytest
=
"~3.4"
[tool.poetry.extras]
time
=
["pendulum"]
[tool.poetry.scripts]
my-script
=
"my_package:main"
my-2nd-script
=
"my_package:main2"
extra-script
=
{callable
=
"my_package.extra:main"
,
extras
=
["time"]
}
tests/masonry/builders/test_builder.py
View file @
27d6fcf7
...
...
@@ -16,3 +16,39 @@ def test_builder_find_excluded_files(mocker):
)
assert
builder
.
find_excluded_files
()
==
{
"my_package/sub_pkg1/extra_file.xml"
}
def
test_builder_find_case_sensitive_excluded_files
(
mocker
):
p
=
mocker
.
patch
(
"poetry.vcs.git.Git.get_ignored_files"
)
p
.
return_value
=
[]
builder
=
Builder
(
Poetry
.
create
(
Path
(
__file__
)
.
parent
/
"fixtures"
/
"case_sensitive_exclusions"
),
NullEnv
(),
NullIO
(),
)
assert
builder
.
find_excluded_files
()
==
{
"my_package/FooBar/Bar.py"
,
"my_package/FooBar/lowercasebar.py"
,
"my_package/Foo/SecondBar.py"
,
"my_package/Foo/Bar.py"
,
"my_package/Foo/lowercasebar.py"
,
"my_package/bar/foo.py"
,
"my_package/bar/CapitalFoo.py"
,
}
def
test_builder_find_invalid_case_sensitive_excluded_files
(
mocker
):
p
=
mocker
.
patch
(
"poetry.vcs.git.Git.get_ignored_files"
)
p
.
return_value
=
[]
builder
=
Builder
(
Poetry
.
create
(
Path
(
__file__
)
.
parent
/
"fixtures"
/
"invalid_case_sensitive_exclusions"
),
NullEnv
(),
NullIO
(),
)
assert
{
"my_package/Bar/foo/bar/Foo.py"
}
==
builder
.
find_excluded_files
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment