Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
10 changes: 9 additions & 1 deletion pyprojectize.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,15 @@ def add_pyproject_check_import(spec: Specfile, sections: Sections) -> ResultMsg:
"%check already has %pyproject_check_import",
)

sections.check[:0] = ["%pyproject_check_import", ""]
check_import = ["%pyproject_check_import"]

# Add an empty line after %pyproject_check_import if
# the current content contains more than one line.
if len([l for l in sections.check if l.strip()]) > 1:
check_import += [""]

sections.check[:0] = check_import

return (
Result.UPDATED,
"existing %check prepended with %pyproject_check_import",
Expand Down
1 change: 0 additions & 1 deletion tests/__all__.spec
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ export CYTHON_COMPILE=1

%check
%pyproject_check_import

%{__python3} setup.py test


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ CYTHON_COMPILE=1 %py3_build -- --use-the-force-luke

%check
%pyproject_check_import

%{__python3} setup.py test


Expand Down
Loading