Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freeze.py doesn't support sys.platlibdir different than lib nor multiarch #86779

Closed
vstinner opened this issue Dec 10, 2020 · 8 comments
Closed
Labels
3.8 only security fixes 3.9 only security fixes 3.10 only security fixes topic-unicode

Comments

@vstinner
Copy link
Member

BPO 42613
Nosy @vstinner, @ezio-melotti, @miss-islington
PRs
  • bpo-42613: Fix freeze.py config directory #23792
  • [3.9] bpo-42613: Fix freeze.py config directory (GH-23792) #23817
  • [3.8] bpo-42613: Fix freeze.py config directory (GH-23792) #23818
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2020-12-16.11:13:01.480>
    created_at = <Date 2020-12-10.10:01:58.787>
    labels = ['3.10', '3.8', '3.9', 'expert-unicode']
    title = "freeze.py doesn't support sys.platlibdir different than lib nor multiarch"
    updated_at = <Date 2020-12-17.14:29:52.696>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2020-12-17.14:29:52.696>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2020-12-16.11:13:01.480>
    closer = 'vstinner'
    components = ['Unicode']
    creation = <Date 2020-12-10.10:01:58.787>
    creator = 'vstinner'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 42613
    keywords = ['patch']
    message_count = 8.0
    messages = ['382821', '383119', '383120', '383122', '383151', '383153', '383235', '383248']
    nosy_count = 3.0
    nosy_names = ['vstinner', 'ezio.melotti', 'miss-islington']
    pr_nums = ['23792', '23817', '23818']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue42613'
    versions = ['Python 3.8', 'Python 3.9', 'Python 3.10']

    @vstinner
    Copy link
    Member Author

    Tools/freeze/freeze.py doesn't support config directory using multiarch nor directory using a sys.platlibdir different than "lib". In short, it doesn't work on Fedora 33 which uses:

    /usr/lib64/python3.10/config-3.10-x86_64-linux-gnu/

    It might be possible to copy/paste the code creating the config-xxx path from Lib/sysconfig.py to Tools/freeze/freeze.py, but I would prefer to reuse code if possible, to make the code more sustainable.

    Maybe we can add a private function to get the path to the "config" directory.

    Or even a public function.

    @vstinner vstinner added 3.10 only security fixes topic-unicode labels Dec 10, 2020
    @vstinner
    Copy link
    Member Author

    Tools/freeze/freeze.py is broken for 4 years, since Python 3.6 which added sys.implementation._multiarch to the config directory in sysconfig:

    commit 5553231
    Author: doko@ubuntu.com <doko@ubuntu.com>
    Date: Tue Jun 14 08:55:19 2016 +0200

    - Issue bpo-23968: Rename the platform directory from plat-$(MACHDEP) to
      plat-$(PLATFORM_TRIPLET).
      Rename the config directory (LIBPL) from config-$(LDVERSION) to
      config-$(LDVERSION)-$(PLATFORM_TRIPLET).
      Install the platform specifc _sysconfigdata module into the platform
      directory and rename it to include the ABIFLAGS.
    

    @vstinner
    Copy link
    Member Author

    I found this issue while working on bpo-42591 which exported the missing Py_FrozenMain() symbol.

    @vstinner
    Copy link
    Member Author

    There are better maintained alternatives:

    • PyOxidizer
    • pyInstaller
    • bbFreeze
    • py2exe
    • cx_Freeze
    • py2app
    • etc.

    @vstinner
    Copy link
    Member Author

    New changeset 1c653f1 by Victor Stinner in branch 'master':
    bpo-42613: Fix freeze.py config directory (GH-23792)
    1c653f1

    @vstinner
    Copy link
    Member Author

    I tested my fix with these commands:
    ---
    ./configure --with-platlibdir=lib64 --enable-shared --prefix /opt/py310 CFLAGS="-O0"
    make
    make install
    # move outside CPython source tree
    cd

    mkdir hello
    cd hello
    echo 'print("hello")' > hello.py

    cp -R ~/python/master/Tools/freeze/ .
    LD_LIBRARY_PATH=/opt/py310/lib /opt/py310/bin/python3.10 freeze/freeze.py hello.py
    ---

    Output:
    ---

    $ LD_LIBRARY_PATH=/opt/py310/lib ./hello 
    hello

    @miss-islington
    Copy link
    Contributor

    New changeset 829272e by Miss Islington (bot) in branch '3.8':
    bpo-42613: Fix freeze.py config directory (GH-23792)
    829272e

    @vstinner
    Copy link
    Member Author

    New changeset 79c5357 by Miss Islington (bot) in branch '3.9':
    bpo-42613: Fix freeze.py config directory (GH-23792) (GH-23817)
    79c5357

    @vstinner vstinner added 3.8 only security fixes 3.9 only security fixes labels Dec 17, 2020
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.8 only security fixes 3.9 only security fixes 3.10 only security fixes topic-unicode
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants