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
a2216ba6
Unverified
Commit
a2216ba6
authored
Jul 24, 2020
by
Sébastien Eustace
Committed by
GitHub
Jul 24, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the editable builder execute build scripts if no setup.py generation (#2718)
parent
c2bab89b
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
64 additions
and
0 deletions
+64
-0
poetry/masonry/builders/editable.py
+8
-0
tests/fixtures/extended_project_without_setup/README.rst
+2
-0
tests/fixtures/extended_project_without_setup/build.py
+0
-0
tests/fixtures/extended_project_without_setup/extended_project/__init__.py
+0
-0
tests/fixtures/extended_project_without_setup/pyproject.toml
+32
-0
tests/masonry/builders/test_editable_builder.py
+22
-0
No files found.
poetry/masonry/builders/editable.py
View file @
a2216ba6
...
...
@@ -43,16 +43,24 @@ class EditableBuilder(Builder):
)
if
self
.
_package
.
build_script
:
if
self
.
_package
.
build_should_generate_setup
():
self
.
_debug
(
" - <warning>Falling back on using a <b>setup.py</b></warning>"
)
return
self
.
_setup_build
()
self
.
_run_build_script
(
self
.
_package
.
build_script
)
added_files
=
[]
added_files
+=
self
.
_add_pth
()
added_files
+=
self
.
_add_scripts
()
self
.
_add_dist_info
(
added_files
)
def
_run_build_script
(
self
,
build_script
):
self
.
_debug
(
" - Executing build script: <b>{}</b>"
.
format
(
build_script
))
self
.
_env
.
run
(
"python"
,
str
(
self
.
_path
.
joinpath
(
build_script
)),
call
=
True
)
def
_setup_build
(
self
):
builder
=
SdistBuilder
(
self
.
_poetry
)
setup
=
self
.
_path
/
"setup.py"
...
...
tests/fixtures/extended_project_without_setup/README.rst
0 → 100644
View file @
a2216ba6
My Package
==========
tests/fixtures/extended_project_without_setup/build.py
0 → 100644
View file @
a2216ba6
tests/fixtures/extended_project_without_setup/extended_project/__init__.py
0 → 100644
View file @
a2216ba6
tests/fixtures/extended_project_without_setup/pyproject.toml
0 → 100644
View file @
a2216ba6
[tool.poetry]
name
=
"extended-project"
version
=
"1.2.3"
description
=
"Some description."
authors
=
[
"Sébastien Eustace <sebastien@eustace.io>"
]
license
=
"MIT"
readme
=
"README.rst"
homepage
=
"https://python-poetry.org"
repository
=
"https://github.com/python-poetry/poetry"
documentation
=
"https://python-poetry.org/docs"
keywords
=
[
"packaging"
,
"dependency"
,
"poetry"
]
classifiers
=
[
"Topic :: Software Development :: Build Tools"
,
"Topic :: Software Development :: Libraries :: Python Modules"
]
[tool.poetry.build]
script
=
"build.py"
generate-setup-file
=
false
# Requirements
[tool.poetry.dependencies]
python
=
"~2.7 || ^3.4"
[tool.poetry.scripts]
foo
=
"foo:bar"
tests/masonry/builders/test_editable_builder.py
View file @
a2216ba6
...
...
@@ -43,6 +43,17 @@ def extended_poetry():
@pytest.fixture
()
def
extended_without_setup_poetry
():
poetry
=
Factory
()
.
create_poetry
(
Path
(
__file__
)
.
parent
.
parent
.
parent
/
"fixtures"
/
"extended_project_without_setup"
)
return
poetry
@pytest.fixture
()
def
env_manager
(
simple_poetry
):
return
EnvManager
(
simple_poetry
)
...
...
@@ -194,3 +205,14 @@ def test_builder_installs_proper_files_when_packages_configured(
assert
paths
.
issubset
(
expected
)
assert
len
(
paths
)
==
len
(
expected
)
def
test_builder_should_execute_build_scripts
(
extended_without_setup_poetry
):
env
=
MockEnv
(
path
=
Path
(
"/foo"
))
builder
=
EditableBuilder
(
extended_without_setup_poetry
,
env
,
NullIO
())
builder
.
build
()
assert
[
[
"python"
,
str
(
extended_without_setup_poetry
.
file
.
parent
/
"build.py"
)]
]
==
env
.
executed
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