Issue36891
Created on 2019-05-11 19:32 by vx1920, last changed 2022-04-11 14:59 by admin. This issue is now closed.
| Pull Requests | |||
|---|---|---|---|
| URL | Status | Linked | Edit |
| PR 13246 | closed | vx1920, 2019-05-11 19:32 | |
| Messages (7) | |||
|---|---|---|---|
| msg342218 - (view) | Author: vx1920 (vx1920) | Date: 2019-05-11 19:32 | |
Proposed modification in site.py allows "sitevendor" customization plugin in addition to existed "sitecustomize" and "usercustomuze". More info displayed when "python.exe -m site" typed from command line. Vendors of Python sites (like Anaconda) can place there their own startup code. Mentioned "sitecustomize" and "usercustomuze" works as before. |
|||
| msg342219 - (view) | Author: SilentGhost (SilentGhost) * ![]() |
Date: 2019-05-11 19:45 | |
This is a larger issue then the PR might lead one to believe. Have you had discussion on python-ideas or in other forums about this? |
|||
| msg342302 - (view) | Author: Inada Naoki (methane) * ![]() |
Date: 2019-05-13 09:58 | |
Why is sitevendor required in addition to sitecustomize? |
|||
| msg342351 - (view) | Author: vx1920 (vx1920) | Date: 2019-05-13 15:58 | |
"sitevendor" is required because "sitecustomize" already "taken": imagine organization XYZ , they install Python/Anaconda for workers in XYZ. Admin in XYZ places some XYZ-specific code into "sitecustomize". As to "usersite" - each worker of XYS uses it for their own purposes. This is what we have now now (in general, as far as I understand the story). Now we have Anaconda in addition to Python distribution. Where do we suppose to place startup related code, which is different between Python and Anaconda ? Example: sys.path to load python py-modules and os.environ['PATH'] to load DLLs. Anaconda already uses some crazy patch in Python/main.c code and it is controlled by environment variables like CONDA_DLL_SEARCH_MODIFICATION_ENABLE. Somebody like you have to explain Anaconda developers that following sitevendor.py shipped with Anaconda may solve this problem (as alternative to patching C code). Real problem in Anaconda is following: attempt to run "python.exe -m conda update --all" gives error in SSL access to update server. Problem is that OpenSSL.dll was moved into PythonHome\Lib\Bin and can't be loaded from there when I run python.exe without activate.bat. Anaconda already solve this problem using above CONDA_DLL_SEARCH_MODIFICATION_ENABLE and it is totally crazy and it introduce problem how to set this variable. They can solve it by shipping sitevendor.py as of: import os import sys prefix = os.path.split(os.path.abspath(sys.executable))[0] env = os.environ env['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' env['CONDA_DEFAULT_ENV'] = 'base' env['CONDA_PREFIX'] = prefix env['CONDA_SHLVL'] = '1' # end of first sitevendor example Next sitevendor.py example presented below: # this sitevendor.py can theoretically be shipped with Anaconde if they want, it works for me even without # any CONDA_DLL_SEARCH_MODIFICATION_ENABLE import os import sys import site from os.path import join, pathsep prefix = os.path.split(os.path.abspath(sys.executable))[0] new_paths = pathsep.join([ prefix, # not required if we start python[w].exe from prefix folder join(prefix, "Library", "mingw-w64", "bin"), join(prefix, "Library", "usr", "bin"), # if not exist: see removeduppath_ex(, True) join(prefix, "Library", "bin"), ##join(prefix, "Scripts") ]) L = [] # empty array for folders from path env = os.environ strpath = new_paths + pathsep + env['PATH']; # string with combined path to array of folders: for dir in strpath.split(';') : L.append(dir); ####print("dir=%s" % (dir)) # remove duplicated and nonexested folders site.removeduppaths_ex(L , True) strpath = pathsep.join(L); ### modify environment variables for current process env['PATH'] = strpath; env['CONDA_PREFIX'] = prefix ###env['CONDA_DLL_SEARCH_MODIFICATION_ENABLE'] = '1' # Python module search path: site.removeduppaths_ex(sys.path , True) # True to remove nonexistent folder/files # eof On Mon, May 13, 2019 at 6:01 AM STINNER Victor <report@bugs.python.org> wrote: > > Change by STINNER Victor <vstinner@redhat.com>: > > > ---------- > nosy: +vstinner > > _______________________________________ > Python tracker <report@bugs.python.org> > <https://bugs.python.org/issue36891> > _______________________________________ > |
|||
| msg342358 - (view) | Author: Inada Naoki (methane) * ![]() |
Date: 2019-05-13 16:48 | |
> vx1920 <vx1920@gmail.com> added the comment: > > "sitevendor" is required because "sitecustomize" already "taken": imagine > organization XYZ , they install Python/Anaconda for workers in XYZ. Admin > in XYZ places some XYZ-specific code into "sitecustomize". I don't think it's common situation. If distribution want to add such "admin"-customization, distributors can implement such additional customization in sitecustomize.py, or even in site.py. For example, Ubuntu uses customized site.py and sitecustomize.py. Is there some discussion in Anaconda developers about proposing "sitevendor" is upstream (CPython)? Or is it just your idea? |
|||
| msg343708 - (view) | Author: STINNER Victor (vstinner) * ![]() |
Date: 2019-05-27 23:43 | |
I dislike the proposed feature. site already allows sitecustomize and usercustomize. If you distribute Python, you can modify site.py anyway. I suggest to close (reject) this feature. |
|||
| msg343723 - (view) | Author: Inada Naoki (methane) * ![]() |
Date: 2019-05-28 00:45 | |
I closed this because this proposal is not discussed well in conda community. See https://github.com/python/cpython/pull/13246#issuecomment-492447317 |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:59:15 | admin | set | github: 81072 |
| 2019-05-28 00:45:51 | methane | set | messages: + msg343723 |
| 2019-05-28 00:43:18 | methane | set | status: open -> closed resolution: rejected stage: resolved |
| 2019-05-27 23:43:05 | vstinner | set | messages: + msg343708 |
| 2019-05-13 16:48:22 | methane | set | messages: + msg342358 |
| 2019-05-13 15:58:41 | vx1920 | set | messages: + msg342351 |
| 2019-05-13 10:01:50 | vstinner | set | nosy:
+ vstinner |
| 2019-05-13 09:58:26 | methane | set | nosy:
+ methane messages: + msg342302 |
| 2019-05-11 19:45:07 | SilentGhost | set | nosy:
+ SilentGhost, ncoghlan messages:
+ msg342219 |
| 2019-05-11 19:32:48 | vx1920 | create | |

