Skip to content

Fix creation of 32-bit environment with dual-architecture python on macOS#1438

Closed
mayeut wants to merge 1 commit intopypa:masterfrom
mayeut:macos-32bit
Closed

Fix creation of 32-bit environment with dual-architecture python on macOS#1438
mayeut wants to merge 1 commit intopypa:masterfrom
mayeut:macos-32bit

Conversation

@mayeut
Copy link
Copy Markdown
Member

@mayeut mayeut commented Nov 10, 2019

Fixes #1437

When using official python.org macOS 64-bit/32-bit installer, creating a virtual environment from a 32-bit interpreter (pythonX.Y-32 -m virtualenv .venv) results in a 64-bit virtual environment when host supports 64-bit. This PR aims to check wether we're running 32/64 bit interpreter and pull the right interpreter if running 32-bit by thinning the original interpreter for i386.

Thanks for contributing a pull request, see checklist all is good!

  • wrote descriptive pull request text
  • added/updated test(s)
  • added news fragment in docs/changelog folder

I think there's no need for a documentation update for this bug fix. News fragment should be enough.

@mayeut
Copy link
Copy Markdown
Member Author

mayeut commented Nov 10, 2019

CI tests failing because of #1439

@mayeut
Copy link
Copy Markdown
Member Author

mayeut commented Nov 10, 2019

Rebased on #1439 to get CI passing.

@mayeut mayeut force-pushed the macos-32bit branch 2 times, most recently from 1954902 to ac66490 Compare November 10, 2019 16:36
Copy link
Copy Markdown
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution, however I feel this PR solves the problem at the wrong place and adds significant overhead, so I'll need to ask you to amend it.

reason="macOS specific test on python 2.7, 3.5, 3.6 & 3.7",
)
def test_dual_arch_macosx(tmpdir):
lookup = {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this test is very heavyweight, I mean downloading the installer from upstream 🤔

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's no CI with dual-architecture python install to my knowledge. If you know of one, please do tell.
That means for complete integration tests as the one implemented here, I don't know better.
Maybe lighter tests could be done by mocking things a bit.
Anyway, I think your next comment needs to be addressed first.

logger.debug("EPD framework detected")
original_python = os.path.join(prefix, "bin/python")
shutil.copy(original_python, py_executable)
original_maxsize = int(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this part to feels a very heavyweight; the way things work feels to me that the copy is that original_python is bad during reinvocation at the start; so that should be fixed not this

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more of an issue. I understand that the current master branch of virtualenv feels bad at the start. But unfortunately, I don't have time to commit on working on this task which is much more that a small fix and needs understanding why this was done in the first place in order to ensure not breaking anything.

@mayeut
Copy link
Copy Markdown
Member Author

mayeut commented Nov 16, 2019

@gaborbernat,

I understand your comments but unfortunately, I don't have any time to rework the PR the way you'd like to. I just can't rework the whole macOS framework virtualenv installation in order to get this fix. I guess I'll stick to the embedded venv module. Python 2.7 is almost EOL anyway.

If master gets reworked the way you'd like, I'd be happy to do some checks regarding this specific issue and open a PR.

@gaborbernat
Copy link
Copy Markdown
Contributor

Yes 👍let's go with trying to validate if this is still an issue with the new rewrite of virtualenv, to be released sometimes next months

@mayeut
Copy link
Copy Markdown
Member Author

mayeut commented Nov 17, 2019

@gaborbernat,
I've tested the rewrite branch, this is not an issue on that branch. I'll redo some tests once the rewrite branch is a bit more advanced (or is it already advanced enough ?)

@gaborbernat
Copy link
Copy Markdown
Contributor

It's not ready for a RC, but hopefully we'll be there in a month 🤞

@mayeut mayeut deleted the macos-32bit branch December 27, 2021 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python3-32 -m virtualenv .venv creates a 64-bit virtual environment

2 participants