#13 Regenerate generated files with python3
Merged 4 years ago by churchyard. Opened 4 years ago by churchyard.
rpms/ churchyard/python38 regenerate  into  master

file modified
+11 -1
@@ -203,6 +203,10 @@ 

  BuildRequires: python-pip-wheel

  %endif

  

+ %if %{without bootstrap}

+ # for make regen-all

+ BuildRequires: python3

+ %endif

  

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

  # Source code and patches
@@ -632,8 +636,14 @@ 

    $ExtraConfigArgs \

    %{nil}

  

+ %if %{without bootstrap}

+   # Regenerate generated files (needs python3)

+   %make_build regen-all PYTHON_FOR_REGEN="python3"

Wouldn't it be safer to hardcode /usr/bin/python3 here?

I don't think so. /usr/bin/python3 is the only Python in $PATH.

+ %endif

+ 

+ 

    # Invoke the build

-   make EXTRA_CFLAGS="$CFLAGS $MoreCFlags" %{?_smp_mflags}

+   %make_build EXTRA_CFLAGS="$CFLAGS $MoreCFlags"

  

    popd

    echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfName

Now this gave me a hard time. We run configure from within sub-sub-folder and regular python3 (the default) dies with ModuleNotFoundError Parser.pgen. The Parser directory is present in $(pwd), but it is empty at this point. I have no idea if this is just supposed to work out of the box, or if this approach with PYTHONPATH inside PYTHON_FOR_REGEN is actually desired.

https://github.com/python/cpython/blob/d7befad328ad1a6d1f812be2bf154c1cd1e01fbc/Makefile.pre.in#L794

I think this would better work as:

- $(PYTHON_FOR_REGEN) -m Parser.pgen $(srcdir)/Grammar/Grammar \
+ PYTHONPATH=$(srcdir) $(PYTHON_FOR_REGEN) -m Parser.pgen $(srcdir)/Grammar/Grammar \

@vstinner should I submit a CPython bug, or am I just trying to do the unsupported?

@vstinner should I submit a CPython bug, or am I just trying to do the unsupported?

Yeah, please open an issue ;-)

Let's wait until the fix is released so we don't have such ugly workaround.

rebased onto 125876bea45a93506251f09d2f78ffecc994ffb7

4 years ago

Rebased on a4. Let's see what happens.

rebased onto 285f554

4 years ago

rebased onto 7e0c125

4 years ago

According the the logs, everything is properly regenerated \o/

Wouldn't it be safer to hardcode /usr/bin/python3 here?

I don't think so. /usr/bin/python3 is the only Python in $PATH.

This is good to merge, please go ahead.

Pull-Request has been merged by churchyard

4 years ago

I just want to say thanks for this change ;-) It's a nice enhancement!