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

Allow users to re-enable the old onedir layout #7968

Merged
merged 6 commits into from
Sep 30, 2023

Commits on Sep 30, 2023

  1. bootloader: cleanup multipackage dependency extraction code

    Clean up and document the multipackage dependency extration code
    in an attempt to make it easier to read.
    
    When determining the parent directory of the current exectuable
    (the former `homepath_parent`, now `this_executable_dir`), use
    `executablename` member of `ARCHIVE_STATUS` instead of `homepath`,
    as the latter is affected by the contents-directory option while
    the former is not. (And this seems to work for onefile builds
    because `homepath` there is also affected by contents-directory,
    even through it should be not).
    
    Remove the useless else-if branch, whose condition is now
    identical to that of the preceding if condition. It was very likely
    unused even in its original form, where it attempted to find the
    dependency by jumping to the parent directory of the directory
    containing the executable, and then applying relative path to the
    other executable. However, this relative path should already
    encode the relative relation between the executables (accounting
    for all four possible combinations regaring build types), and as
    such jumping one directory higher would never work.
    
    Fix the path check for the external .PKG archive (side-load mode).
    Such archive is located next to the executable, and is not a subject
    to contents-directory setting.
    rokm committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    6d30d32 View commit details
    Browse the repository at this point in the history
  2. bootloader: allow pyi-contents-directory option to be unset

    Allow pyi-contents-directory option to be unset, which re-enables
    the old layout for onedir builds, where files are placed next to
    the executable (instead of placing them into sub-directory).
    rokm committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    a5e8783 View commit details
    Browse the repository at this point in the history
  3. building: allow user to re-enable old onedir layout

    Allow user to re-enable old onedir layout without contents
    directory. This can be done by setting `contents_directory`
    argument to `EXE` in the spec to either ".", "", or None (all
    three values are effectively mapped to None, which prevents
    the `pyi-contents-directory` bootloader option from being set).
    On command line, the equivalent can be achieved by passing "."
    to `--contents-directory` command-line option.
    rokm committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    b9c466e View commit details
    Browse the repository at this point in the history
  4. bootloader: apply contents-directory to homepath only in onedir mode

    Append contents-directory path to homepath member of ARCHIVE_STATUS
    only in onedir mode (i.e., if we do not need to extract the
    archive).
    
    This implies that we need to check whether extraction is required
    when we open the archive (before homepath is set), so move the
    corresponding code into `pyi_arch_setup`.
    rokm committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    e2d01c6 View commit details
    Browse the repository at this point in the history
  5. tests: adjust test_contents_directory

    Test for `..` as an invalid contents-directory option instead of
    `.`, which is now valid.
    rokm committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    ac55aa9 View commit details
    Browse the repository at this point in the history
  6. tests: add a test for legacy onedir mode

    Add a basic test with --contents-directory=. that checks if
    `sys._MEIPASS` == `os.path.dirname(sys.executable)`, which should
    be the case in the legacy onedir layout.
    rokm committed Sep 30, 2023
    Configuration menu
    Copy the full SHA
    4264076 View commit details
    Browse the repository at this point in the history