#3 Update to 0.9.21 to fix Python 3.9 problems, unbundle ply
Merged 3 years ago by cstratak. Opened 3 years ago by churchyard.
rpms/ churchyard/xonsh 0.9.21  into  master

file modified
+1
@@ -27,3 +27,4 @@ 

  /xonsh-0.9.13.tar.gz

  /xonsh-0.9.16.tar.gz

  /xonsh-0.9.17.tar.gz

+ /xonsh-0.9.21.tar.gz

file modified
+1 -1
@@ -1,1 +1,1 @@ 

- SHA512 (xonsh-0.9.17.tar.gz) = b3ca2cfea15f3315268cdbc31c863627f86dc34445d2095c0952fd69a7ddaa17255aa93ae7d4561c8756d6a01501d9261f02d9b223e839f579b749c74fa5e959

+ SHA512 (xonsh-0.9.21.tar.gz) = aab62bc51dafacefe86437e360b230855a153cdf5117507caa7974e557068c6c1903d92d98da1fc6df2ed49d59fc70f494da53b13c01b5548488e4da1186a483

file modified
+39 -25
@@ -1,6 +1,6 @@ 

  Name:           xonsh

- Version:        0.9.17

- Release:        3%{?dist}

+ Version:        0.9.21

+ Release:        1%{?dist}

  Summary:        A general purpose, Python-ish shell

  

  # xonsh is BSD-2-Clause.
@@ -11,20 +11,29 @@ 

  BuildArch:      noarch

  

  BuildRequires:  python%{python3_pkgversion}-devel

- BuildRequires:  python%{python3_pkgversion}-setuptools

+ BuildRequires:  %{py3_dist setuptools}

  BuildRequires:  %{py3_dist ply}

  BuildRequires:  %{py3_dist prompt-toolkit}

  BuildRequires:  %{py3_dist pygments}

  BuildRequires:  %{py3_dist pytest}

- BuildRequires:  git

+ BuildRequires:  git-core

  BuildRequires:  man-db

- Requires:       python3 >= 3.4

- Requires:       %{py3_dist ply}

+ # needed for tests:

+ BuildRequires:  /usr/bin/python

+ 

+ # required by "ptk" extra:

  Requires:       %{py3_dist prompt-toolkit}

+ 

+ # required by "setproctitle" extra:

  Requires:       %{py3_dist setproctitle}

+ 

+ # required by "full" extra:

+ #Requires:      %%{py3_dist ptk} -- not available

  Requires:       %{py3_dist pygments}

  Requires:       %{py3_dist distro}

  

+ # unbundled in %%prep

+ Requires:       %{py3_dist ply}

  

  %description

  xonsh is a Python-powered, cross-platform, Unix-gazing shell language and
@@ -35,34 +44,37 @@ 

  %prep

  %autosetup -n %{name}-%{version}

  

- %build

+ # Unbundle ply

+ sed --in-place '/xonsh\.ply/d' setup.py

+ sed --in-place -e 's/xonsh\.ply\.ply/ply/' \

+                -e 's/from xonsh\.ply //' \

+                $(grep -rl --include='*.py' 'xonsh\.ply')

+ rm -r xonsh/ply

+ 

  # Remove shebang.

- sed --in-place "s:#!\s*/usr.*::" xonsh/xoreutils/_which.py

+ sed --in-place "s:#!\s*/usr.*::" xonsh/xoreutils/_which.py xonsh/webconfig/main.py

  

+ %build

  %py3_build

  

  %install

  %py3_install

  

- # py3_build produces erroneous shebangs. Fix them.

- # https://bugzilla.redhat.com/show_bug.cgi?id=1335203

- pathfix.py -i "%{__python3} %{py3_shbang_opts}u" -p -n %{buildroot}%{_bindir}/xonsh

- pathfix.py -i "%{__python3} %{py3_shbang_opts}u" -p -n %{buildroot}%{_bindir}/xonsh-cat

- 

  %check

+ # test_parser.py is mostly incompatible with Python 3.8+

+ sed --in-place "s:ignores = \[\]:ignores = \['--ignore', 'tests/test_parser.py'\]:" run-tests.xsh

+ 

+ # let upstream do the linting

+ sed --in-place '/flake8/d' run-tests.xsh

+ 

  # The tests only succeed if:

  #

  # - They are run from within a xonsh shell.

- # - They are run with the `py.test-3` executable instead of `python3 -m pytest`.

+ # - They are run with xonsh directly instead of `python3 -m pytest`.

  #

  # The run-tests.xsh script does those things for us.

- 

- if [ "%{python3_version_nodots}" -ge "38" ]; then

-   sed --in-place "s:ignores = \[\]:ignores = \['--ignore', 'tests/test_parser.py'\]:" run-tests.xsh

- fi

- 

- sed --in-place "s:pytest:py.test-3:" run-tests.xsh

- PYTHONDONTWRITEBYTECODE=1 PYTHONPATH=%{buildroot}%{python3_sitelib} PATH="%{buildroot}%{_bindir}:$PATH" %{buildroot}%{_bindir}/xonsh run-tests.xsh

+ %global __pytest xonsh run-tests.xsh

+ %pytest

  

  %post

  if [ "$1" -ge 1 ]; then
@@ -94,11 +106,13 @@ 

  %{python3_sitelib}/xonsh-%{version}*-py%{python3_version}.egg-info/

  

  %changelog

- * Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 0.9.17-3

- - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

- 

- * Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 0.9.17-2

+ * Thu Sep 10 2020 Miro Hrončok <mhroncok@redhat.com> - 0.9.21-1

  - Rebuilt for Python 3.9

+ - Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

+ - Update to 0.9.21

+ - Unbundle ply

+ - Fixes: rhbz#1817770

+ - Fixes: rhbz#1822355

  

  * Fri Apr 10 2020 Carmen Bianca Bakker <carmenbianca@fedoraproject.org> - 0.9.17-1

  - new version

Clean the spec here and there

If I read the sources of the macros correctly, the 's' was added before by the default value of py3_shbang_opts. py3_shebang_flags doesn't add anything by default, hence the need to provide the 'su' flags. Is my understanding correct?

rebased onto b6062d4

3 years ago

I don't like too much overriding the default %pytest macro here, I would prefer to just invoke the command directly, but it's just a preference, definitely not a blocker.

The %py3_(build|install) macros have a broken implementation of the shebang mangling and the shebang ends up being: ..python -s -u -- which blows up.

The fix before this PR was to use:

pathfix.py -i "%{__python3} %{py3_shbang_opts}u"

Hence:

pathfix.py -i "%{__python3} -su"

I've adapted the fix to use new macros:

  1. set the shwbang flags to su (instead of just s)
  2. use %py3_shebang_fix

However (!) setting the flags should not be necessary, because %py3_shebang_fix preserves the existing flags. let me check.

The entire construct can be removed with this version of xonsh. Done.

rebased onto eceded2

3 years ago

Is flake8 necessary for the tests? Could we sed or patch out linting?

I don't like too much overriding the default %pytest macro here, I would prefer to just invoke the command directly, but it's just a preference, definitely not a blocker.

Using the pytest macro we ensure the proper (and globally managed) environment variables are set. This is why the %__pytest macro exists (so it can be redefined).

I've seen from upstream that ply had been bundled for some versions already, so this is not an issue related entirely with the update, but an overall improvement for the package, right? Unless there was a different reason for the unbundling?

rebased onto 11e0940

3 years ago

Is flake8 necessary for the tests? Could we sed or patch out linting?

Sedded out.

I've seen from upstream that ply had been bundled for some versions already, so this is not an issue related entirely with the update, but an overall improvement for the package, right?

Yes.

rebased onto ec2ce9d

3 years ago

I see also xonsh/amalgam.py importing xonsh.ply

The entire construct can be removed with this version of xonsh. Done.

Nice. By checking the shebangs of the unpacked files from the binary rpm I didn't see any problematic shebangs.

I see also xonsh/amalgam.py importing xonsh.ply

Apart from that, the rest look good to me.

rebased onto 612365a

3 years ago

I've adapted the sed to modify all files that match a grep call, so it's more bulletproof.

@cstratak if you get to it and everything is alright, please build in master and f33, I'm going AFK.

Thank for the review, it was very helpful.

Pull-Request has been merged by cstratak

3 years ago