Skip to content

Commit

Permalink
Merge bd5bc90 into 955cdcb
Browse files Browse the repository at this point in the history
  • Loading branch information
danigm committed Mar 20, 2024
2 parents 955cdcb + bd5bc90 commit 67de53e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
1 change: 1 addition & 0 deletions spec_cleaner/rpmregexp.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ class Regexp(object):
r'%{?(python_sitelib|python_sitearch|python_bin_suffix|python_version)}?'
)
re_python_interp_expand = re.compile(r'\s+(python)\s+')
re_python_module = re.compile(r'.*\s%{python_module\s.*}')

# rpmcopyright
re_copyright_string = re.compile(r'^#\s*Copyright\ \(c\)\s*(.*)', re.IGNORECASE)
Expand Down
7 changes: 6 additions & 1 deletion spec_cleaner/rpmsection.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ def _complete_cleanup(self, line: str) -> str:
line = line.replace(u'\xa0', ' ')

if not line.startswith('#'):
if not self.minimal and not self.no_curlification:
is_python_module = self.reg.re_python_module.match(line)
if (not self.minimal
and not self.no_curlification
# Do not embrace macros inside python_module
# gh#rpm-software-management/spec-cleaner#321
and not is_python_module):
line = self.embrace_macros(line)
line = self.replace_buildroot(line)
line = self.replace_optflags(line)
Expand Down
15 changes: 15 additions & 0 deletions tests/in/python-conditional-buildrequires.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
BuildRequires: %{python_module tomli >= 1.2.2 if %python-base < 3.11}
Requires: %oldpython-base

%install
%python_expand %fdupes %{buildroot}%{python_sitelib}
%python_expand %fdupes %{buildroot}%{python_sitearch}


%check
%python_expand PYTHONPATH=%{python_sitearch} nosetests-%{python_bin_suffix}
%python_expand testr-%{python_version}
%{python_expand python -m unittest discover}

%changelog

14 changes: 14 additions & 0 deletions tests/out/python-conditional-buildrequires.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BuildRequires: %{python_module tomli >= 1.2.2 if %python-base < 3.11}
Requires: %{oldpython}-base

%install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%python_expand %fdupes %{buildroot}%{$python_sitearch}


%check
%python_expand PYTHONPATH=%{$python_sitearch} nosetests-%{$python_bin_suffix}
%python_expand testr-%{$python_version}
%{python_expand $python -m unittest discover}

%changelog

0 comments on commit 67de53e

Please sign in to comment.