| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Allow overriding :data:`sys.platlibdir` via a new :envvar:`PYTHONPLATLIBDIR` environment variable. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -548,6 +548,13 @@ static int test_init_from_config(void) | |
| /* FIXME: test home */ | ||
| /* FIXME: test path config: module_search_path .. dll_path */ | ||
|
|
||
| putenv("PYTHONPLATLIBDIR=env_platlibdir"); | ||
| status = PyConfig_SetBytesString(&config, &config.platlibdir, "my_platlibdir"); | ||
| if (PyStatus_Exception(status)) { | ||
| PyConfig_Clear(&config); | ||
| Py_ExitStatusException(status); | ||
| } | ||
|
|
||
|
Comment thread
Outdated
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Qualitynitpick: one empty line is enough :-)
Sorry, something went wrong.
All reactions
|
||
| putenv("PYTHONVERBOSE=0"); | ||
| Py_VerboseFlag = 0; | ||
| config.verbose = 1; | ||
| Expand Down Expand Up | @@ -668,6 +675,7 @@ static void set_most_env_vars(void) | |
| putenv("PYTHONFAULTHANDLER=1"); | ||
| putenv("PYTHONIOENCODING=iso8859-1:replace"); | ||
| putenv("PYTHONOLDPARSER=1"); | ||
| putenv("PYTHONPLATLIBDIR=env_platlibdir"); | ||
| } | ||
|
|
||
|
|
||
| Expand Down | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| Expand Up | @@ -24,6 +24,10 @@ | |
| # endif | ||
| #endif | ||
|
|
||
| #ifndef PLATLIBDIR | ||
| # error "PLATLIBDIR macro must be defined" | ||
| #endif | ||
|
|
||
|
|
||
| /* --- Command line options --------------------------------------- */ | ||
|
|
||
| Expand Down Expand Up | @@ -110,6 +114,7 @@ PYTHONPATH : '%lc'-separated list of directories prefixed to the\n\ | |
| static const char usage_5[] = | ||
| "PYTHONHOME : alternate <prefix> directory (or <prefix>%lc<exec_prefix>).\n" | ||
| " The default module search path uses %s.\n" | ||
| "PYTHONPLATLIBDIR : override sys.platlibdir.\n" | ||
| "PYTHONCASEOK : ignore case in 'import' statements (Windows).\n" | ||
| "PYTHONUTF8: if set to 1, enable the UTF-8 mode.\n" | ||
| "PYTHONIOENCODING: Encoding[:errors] used for stdin/stdout/stderr.\n" | ||
| Expand Down Expand Up | @@ -588,6 +593,7 @@ PyConfig_Clear(PyConfig *config) | |
| CLEAR(config->base_prefix); | ||
| CLEAR(config->exec_prefix); | ||
| CLEAR(config->base_exec_prefix); | ||
| CLEAR(config->platlibdir); | ||
|
|
||
| CLEAR(config->filesystem_encoding); | ||
| CLEAR(config->filesystem_errors); | ||
| Expand Down Expand Up | @@ -824,6 +830,7 @@ _PyConfig_Copy(PyConfig *config, const PyConfig *config2) | |
| COPY_WSTR_ATTR(base_prefix); | ||
| COPY_WSTR_ATTR(exec_prefix); | ||
| COPY_WSTR_ATTR(base_exec_prefix); | ||
| COPY_WSTR_ATTR(platlibdir); | ||
|
|
||
| COPY_ATTR(site_import); | ||
| COPY_ATTR(bytes_warning); | ||
| Expand Down Expand Up | @@ -926,6 +933,7 @@ config_as_dict(const PyConfig *config) | |
| SET_ITEM_WSTR(base_prefix); | ||
| SET_ITEM_WSTR(exec_prefix); | ||
| SET_ITEM_WSTR(base_exec_prefix); | ||
| SET_ITEM_WSTR(platlibdir); | ||
| SET_ITEM_INT(site_import); | ||
| SET_ITEM_INT(bytes_warning); | ||
| SET_ITEM_INT(inspect); | ||
| Expand Down Expand Up | @@ -1336,6 +1344,14 @@ config_read_env_vars(PyConfig *config) | |
| } | ||
| } | ||
|
|
||
| if(config->platlibdir == NULL) { | ||
| status = CONFIG_GET_ENV_DUP(config, &config->platlibdir, | ||
| L"PYTHONPLATLIBDIR", "PYTHONPLATLIBDIR"); | ||
| if (_PyStatus_EXCEPTION(status)) { | ||
| return status; | ||
| } | ||
| } | ||
|
|
||
| if (config->use_hash_seed < 0) { | ||
| status = config_init_hash_seed(config); | ||
| if (_PyStatus_EXCEPTION(status)) { | ||
| Expand Down Expand Up | @@ -1731,6 +1747,14 @@ config_read(PyConfig *config) | |
| } | ||
| } | ||
|
|
||
| if(config->platlibdir == NULL) { | ||
| status = CONFIG_SET_BYTES_STR(config, &config->platlibdir, PLATLIBDIR, | ||
| "PLATLIBDIR macro"); | ||
|
Comment thread
Copy link
Copy Markdown
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low QualityOh, I didn't notice the Makefile change to define PLATLIBDIR macro. Please add an explicit check to ensure that it's defined. See Modules/getpath.c. I sugges to add at the top of this file, after includes (on Windows, it's defined by PC/pyconfig.h which is included by Python.h): #ifndef PLATLIBDIR # error "PLATLIBDIR macro must be defined" #endif
Sorry, something went wrong.
All reactions
|
||
| if (_PyStatus_EXCEPTION(status)) { | ||
| return status; | ||
| } | ||
| } | ||
|
|
||
| if (config->_install_importlib) { | ||
| status = _PyConfig_InitPathConfig(config); | ||
| if (_PyStatus_EXCEPTION(status)) { | ||
| Expand Down Expand Up | @@ -2554,6 +2578,7 @@ PyConfig_Read(PyConfig *config) | |
| assert(config->exec_prefix != NULL); | ||
| assert(config->base_exec_prefix != NULL); | ||
| } | ||
| assert(config->platlibdir != NULL); | ||
| assert(config->filesystem_encoding != NULL); | ||
| assert(config->filesystem_errors != NULL); | ||
| assert(config->stdio_encoding != NULL); | ||
| Expand Down Expand Up | @@ -2704,6 +2729,7 @@ _Py_DumpPathConfig(PyThreadState *tstate) | |
| DUMP_SYS(_base_executable); | ||
| DUMP_SYS(base_prefix); | ||
| DUMP_SYS(base_exec_prefix); | ||
| DUMP_SYS(platlibdir); | ||
| DUMP_SYS(executable); | ||
| DUMP_SYS(prefix); | ||
| DUMP_SYS(exec_prefix); | ||
| Expand Down | ||
| Back | FazBrowse Home | New Git URL |
Uh oh!
There was an error while loading. Please reload this page.