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

Define SOABI, LIBRARY, LDLIBRARY and LIBPL on Windows #88402

Closed
zooba opened this issue May 25, 2021 · 8 comments
Closed

Define SOABI, LIBRARY, LDLIBRARY and LIBPL on Windows #88402

zooba opened this issue May 25, 2021 · 8 comments
Labels
3.10 only security fixes 3.11 only security fixes OS-windows topic-sysconfig

Comments

@zooba
Copy link
Member

zooba commented May 25, 2021

BPO 44236
Nosy @pfmoore, @tjguk, @zware, @zooba

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 = None
created_at = <Date 2021-05-25.15:15:02.518>
labels = ['3.10', 'OS-windows', '3.11']
title = 'Define SOABI, LIBRARY, LDLIBRARY and LIBPL on Windows'
updated_at = <Date 2021-05-25.15:18:34.574>
user = 'https://github.com/zooba'

bugs.python.org fields:

activity = <Date 2021-05-25.15:18:34.574>
actor = 'steve.dower'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Windows']
creation = <Date 2021-05-25.15:15:02.518>
creator = 'steve.dower'
dependencies = []
files = []
hgrepos = []
issue_num = 44236
keywords = []
message_count = 2.0
messages = ['394368', '394369']
nosy_count = 4.0
nosy_names = ['paul.moore', 'tim.golden', 'zach.ware', 'steve.dower']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue44236'
versions = ['Python 3.10', 'Python 3.11']

Linked PRs

@zooba
Copy link
Member Author

zooba commented May 25, 2021

Python on Windows currently has no values in sysconfig to locate the lib files for building. Though these are very predictable (for now), it would be nice to have them in the same place as for other platforms.

I propose defining the following config vars in sysconfig:

LIBRARY=Path(_winapi.GetModuleFileName(sys.dllhandle)).stem
LDLIBRARY=Path(_winapi.GetModuleFileName(sys.dllhandle)).name
LIBPL=Path(sys.prefix) / "libs"
SOABI=<SO but without '.' and '.pyd'>

Are there better shared names for these? Or others that should be added?

@zooba zooba added 3.10 only security fixes 3.11 only security fixes OS-windows labels May 25, 2021
@zooba
Copy link
Member Author

zooba commented May 25, 2021

Should actually be:

LIBPL=Path(sysconfig.get_config_var("installed_base")) / "libs"

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
@tasty0tomato
Copy link

Tools/freeze.py may not work on Windows because of this.

configdir = sysconfig.get_config_var('LIBPL')

@zooba
Copy link
Member Author

zooba commented Feb 20, 2023

Well, we know it currently works well enough to pass tests, so there must be some other way that it handles that variable not currently existing. It's possible though that providing that value would cause it to start failing.

And now I've been reminded of this issue, ping @FFY00

@FFY00
Copy link
Member

FFY00 commented Feb 20, 2023

I propose defining the following config vars in sysconfig:

I think it's a good idea, we could definitely use this downstream until we have a better place to expose this information. Adding this should be fairly easy, the new variables just need to be added to _init_non_posix, if anyone wants to open a PR.

def _init_non_posix(vars):

I'd also probably add a test to make sure they match with the values in importlib.machinery.EXTENSION_SUFFIXES

Should actually be:

Yes, it should be derived from installed_base.

@colesbury
Copy link
Contributor

Adding this should be fairly easy, the new variables just need to be added to _init_non_posix, if anyone wants to open a PR.

I can put up a PR for this. I think having SOABI consistent defined will be useful for PEP 703, and it'd be helpful to have sysconfig.get_config_var('Py_NOGIL') work on Windows as well.

@FFY00
Copy link
Member

FFY00 commented Sep 28, 2023

@colesbury, yeah please do! I'd be happy to review it.

colesbury added a commit to colesbury/cpython that referenced this issue Sep 28, 2023
This adds `LIBRARY`, `LDLIBRARY`, `LIBPL`, `SOABI`, and `Py_NOGIL`
variables to sysconfig on Windows. Note that `Py_NOGIL` is only defined
in `--disable-gil` builds.
FFY00 added a commit that referenced this issue Oct 4, 2023
Co-authored-by: Filipe Laíns <filipe.lains@gmail.com>
@FFY00
Copy link
Member

FFY00 commented Oct 5, 2023

GH-110049 landed thanks to @colesbury, which implemented this, but with the following differences from the original proposal:

  • LIBDIR was used instead of LIBPL, as it better matches the POSIX semantics (discussion)
  • LIBRARY exposes the libpython DLL name instead of the path to the directory where it is contained (discussion)
  • Py_NOGIL was also added

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.10 only security fixes 3.11 only security fixes OS-windows topic-sysconfig
Projects
None yet
Development

No branches or pull requests

4 participants