#47 Add /usr/bin/pygettext3.py and msgfmt3.py to python3-devel + Renew check-pyc-timestamps.py
Merged 5 years ago by churchyard. Opened 5 years ago by churchyard.
rpms/ churchyard/python3 gettextbin  into  master

@@ -1,62 +0,0 @@ 

- """Checks if all *.pyc and *.pyo files have later mtime than their *.py files."""

- 

- import importlib.util

- import os

- import sys

- 

- # list of test and other files that we expect not to have bytecode

- not_compiled = [

-     '/usr/bin/pathfix.py',

-     'test/bad_coding.py',

-     'test/bad_coding2.py',

-     'test/badsyntax_3131.py',

-     'test/badsyntax_future3.py',

-     'test/badsyntax_future4.py',

-     'test/badsyntax_future5.py',

-     'test/badsyntax_future6.py',

-     'test/badsyntax_future7.py',

-     'test/badsyntax_future8.py',

-     'test/badsyntax_future9.py',

-     'test/badsyntax_future10.py',

-     'test/badsyntax_async1.py',

-     'test/badsyntax_async2.py',

-     'test/badsyntax_async3.py',

-     'test/badsyntax_async4.py',

-     'test/badsyntax_async5.py',

-     'test/badsyntax_async6.py',

-     'test/badsyntax_async7.py',

-     'test/badsyntax_async8.py',

-     'test/badsyntax_async9.py',

-     'test/badsyntax_pep3120.py',

-     'lib2to3/tests/data/bom.py',

-     'lib2to3/tests/data/crlf.py',

-     'lib2to3/tests/data/different_encoding.py',

-     'lib2to3/tests/data/false_encoding.py',

-     'lib2to3/tests/data/py2_test_grammar.py',

-     '.debug-gdb.py',

- ]

- failed = 0

- 

- 

- def bytecode_expected(source):

-     for f in not_compiled:

-         if source.endswith(f):

-             return False

-     return True

- 

- 

- compiled = filter(lambda f: bytecode_expected(f), sys.argv[1:])

- for f in compiled:

-     # check both pyo and pyc

-     to_check = map(lambda b: importlib.util.cache_from_source(f, b), (True, False))

-     f_mtime = os.path.getmtime(f)

-     for c in to_check:

-         c_mtime = os.path.getmtime(c)

-         if c_mtime < f_mtime:

-             sys.stderr.write('Failed bytecompilation timestamps check: ')

-             sys.stderr.write('Bytecode file {} is older than source file {}.\n'.format(c, f))

-             failed += 1

- 

- if failed:

-     sys.stderr.write('\n{} files failed bytecompilation timestamps check.\n'.format(failed))

-     sys.exit(1)

@@ -0,0 +1,55 @@ 

+ """Checks if all *.pyc files have later mtime than their *.py files."""

+ 

+ import os

+ import sys

+ from importlib.util import cache_from_source

+ from pathlib import Path

+ 

+ 

+ RPM_BUILD_ROOT = os.environ.get('RPM_BUILD_ROOT', '')

+ 

+ # ...cpython-3X.pyc

+ # ...cpython-3X.opt-1.pyc

+ # ...cpython-3X.opt-2.pyc

+ LEVELS = (None, 1, 2)

+ 

+ # list of globs of test and other files that we expect not to have bytecode

+ not_compiled = [

+     '/usr/bin/*',

+     '*/test/bad_coding.py',

+     '*/test/bad_coding2.py',

+     '*/test/badsyntax_*.py',

+     '*/lib2to3/tests/data/bom.py',

+     '*/lib2to3/tests/data/crlf.py',

+     '*/lib2to3/tests/data/different_encoding.py',

+     '*/lib2to3/tests/data/false_encoding.py',

+     '*/lib2to3/tests/data/py2_test_grammar.py',

+     '*.debug-gdb.py',

+ ]

+ 

+ 

+ def bytecode_expected(path):

+     path = Path(path[len(RPM_BUILD_ROOT):])

+     for glob in not_compiled:

+         if path.match(glob):

+             return False

+     return True

+ 

+ 

+ failed = 0

+ compiled = (path for path in sys.argv[1:] if bytecode_expected(path))

+ for path in compiled:

+     to_check = (cache_from_source(path, optimization=opt) for opt in LEVELS)

+     f_mtime = os.path.getmtime(path)

+     for pyc in to_check:

+         c_mtime = os.path.getmtime(pyc)

+         if c_mtime < f_mtime:

+             print('Failed bytecompilation timestamps check: '

+                   f'Bytecode file {pyc} is older than source file {path}',

+                   file=sys.stderr)

+             failed += 1

+ 

+ if failed:

+     print(f'\n{failed} files failed bytecompilation timestamps check.',

+           file=sys.stderr)

+     sys.exit(1)

file modified
+23 -3
@@ -14,7 +14,7 @@ 

  #  WARNING  When rebasing to a new Python version,

  #           remember to update the python3-docs package as well

  Version: %{pybasever}.0

- Release: 7%{?dist}

+ Release: 8%{?dist}

  License: Python

  

  
@@ -200,8 +200,8 @@ 

  

  # A simple script to check timestamps of bytecode files

  # Run in check section with Python that is currently being built

- # Written by bkabrda

- Source8: check-pyc-and-pyo-timestamps.py

+ # Originally written by bkabrda

+ Source8: check-pyc-timestamps.py

  

  # Desktop menu entry for idle3

  Source10: idle3.desktop
@@ -893,6 +893,14 @@ 

  # See https://github.com/fedora-python/python-rpm-porting/issues/24

  cp -p Tools/scripts/pathfix.py %{buildroot}%{_bindir}/

  

+ # Install i18n tools to bindir

+ # They are also in python2, so we version them

+ # https://bugzilla.redhat.com/show_bug.cgi?id=1571474

+ for tool in pygettext msgfmt; do

+   cp -p Tools/i18n/${tool}.py %{buildroot}%{_bindir}/${tool}%{pybasever}.py

+   ln -s ${tool}%{pybasever}.py %{buildroot}%{_bindir}/${tool}3.py

+ done

+ 

  # Switch all shebangs to refer to the specific Python version.

  # This currently only covers files matching ^[a-zA-Z0-9_]+\.py$,

  # so handle files named using other naming scheme separately.
@@ -900,6 +908,7 @@ 

    Tools/scripts/pathfix.py \

    -i "%{_bindir}/python%{pybasever}" -pn \

    %{buildroot} \

+   %{buildroot}%{_bindir}/*%{pybasever}.py \

    %{?with_gdb_hooks:%{buildroot}$DirHoldingGdbPy/*.py}

  

  # Remove tests for python3-tools which was removed in
@@ -964,6 +973,8 @@ 

  rm %{buildroot}%{_bindir}/python3

  rm %{buildroot}%{_bindir}/pydoc3

  rm %{buildroot}%{_bindir}/pathfix.py

+ rm %{buildroot}%{_bindir}/pygettext3.py

+ rm %{buildroot}%{_bindir}/msgfmt3.py

  rm %{buildroot}%{_bindir}/idle3

  rm %{buildroot}%{_bindir}/python3-*

  rm %{buildroot}%{_bindir}/pyvenv
@@ -1328,8 +1339,13 @@ 

  %{_bindir}/python3-config

  %{_libdir}/pkgconfig/python3.pc

  %{_bindir}/pathfix.py

+ %{_bindir}/pygettext3.py

+ %{_bindir}/msgfmt3.py

  %endif

  

+ %{_bindir}/pygettext%{pybasever}.py

+ %{_bindir}/msgfmt%{pybasever}.py

+ 

  %{_bindir}/python%{pybasever}-config

  %{_bindir}/python%{LDVERSION_optimized}-config

  %{_bindir}/python%{LDVERSION_optimized}-*-config
@@ -1528,6 +1544,10 @@ 

  # ======================================================

  

  %changelog

+ * Fri Aug 17 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-8

+ - Add /usr/bin/pygettext3.py and msgfmt3.py to python3-devel

+ Resolves: rhbz#1571474

+ 

  * Fri Aug 17 2018 Miro Hrončok <mhroncok@redhat.com> - 3.7.0-7

  - Backport TLS 1.3 related fixes to fix FTBFS

  Resolves: rhbz#1609291

2 unrelated changes, yet I've done the second as a reaction for changes required for the first. See individual commits.

The build failure maybe relates to new OpenSSL.

It also fails at https://apps.fedoraproject.org/koschei/package/python3

(I'll rebase this once we build.)

LGTM. Can you build with the SSL tests skipped?

rebased onto 7b205e42a300c98d6bb1a3c8baec0cf7a3109562

5 years ago

1 new commit added

  • DON'T MERGE THIS Disable SSL tests to see if this works
5 years ago

2 new commits added

  • Renew check-pyc-timestamps.py
  • Add /usr/bin/pygettext3.py and msgfmt3.py to python3-devel
5 years ago

Simple Koji CI for 6e78d7f8 has the tests disabled.

Looks good!
Please rebase for one last simple-CI check, and merge if it builds :)

rebased onto 4aa9ebc

5 years ago

Thanks.

Rebased on top of https://src.fedoraproject.org/rpms/python3/pull-request/51 - will merge that one first. Waiting for CI to finish there and here.

rebased onto 83a5f52

5 years ago

Pull-Request has been merged by churchyard

5 years ago