Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
123536fd
Commit
123536fd
authored
Jul 24, 2019
by
Steve Dower
Committed by
GitHub
Jul 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bpo-37672: Switch Windows Store package to use pip.ini for user mode (GH-14939)
parent
e018dc52
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
50 additions
and
35 deletions
+50
-35
Misc/NEWS.d/next/Windows/2019-07-24-14-36-28.bpo-37672.uKEVHN.rst
...S.d/next/Windows/2019-07-24-14-36-28.bpo-37672.uKEVHN.rst
+2
-0
PC/layout/main.py
PC/layout/main.py
+1
-1
PC/layout/support/pip.py
PC/layout/support/pip.py
+5
-1
PC/python_uwp.cpp
PC/python_uwp.cpp
+42
-33
No files found.
Misc/NEWS.d/next/Windows/2019-07-24-14-36-28.bpo-37672.uKEVHN.rst
0 → 100644
View file @
123536fd
Switch Windows Store package's pip to use bundled :file:`pip.ini` instead of
:envvar:`PIP_USER` variable.
PC/layout/main.py
View file @
123536fd
...
@@ -228,7 +228,7 @@ def get_layout(ns):
...
@@ -228,7 +228,7 @@ def get_layout(ns):
if
ns
.
include_pip
:
if
ns
.
include_pip
:
for
dest
,
src
in
get_pip_layout
(
ns
):
for
dest
,
src
in
get_pip_layout
(
ns
):
if
isinstance
(
src
,
tuple
)
or
not
(
if
not
isinstance
(
src
,
tuple
)
and
(
src
in
EXCLUDE_FROM_LIB
or
src
in
EXCLUDE_FROM_PACKAGED_LIB
src
in
EXCLUDE_FROM_LIB
or
src
in
EXCLUDE_FROM_PACKAGED_LIB
):
):
continue
continue
...
...
PC/layout/support/pip.py
View file @
123536fd
...
@@ -33,7 +33,11 @@ def get_pip_layout(ns):
...
@@ -33,7 +33,11 @@ def get_pip_layout(ns):
pkg_root
=
"packages/{}"
if
ns
.
zip_lib
else
"Lib/site-packages/{}"
pkg_root
=
"packages/{}"
if
ns
.
zip_lib
else
"Lib/site-packages/{}"
for
dest
,
src
in
rglob
(
pip_dir
,
"**/*"
):
for
dest
,
src
in
rglob
(
pip_dir
,
"**/*"
):
yield
pkg_root
.
format
(
dest
),
src
yield
pkg_root
.
format
(
dest
),
src
yield
"pip.ini"
,
(
"pip.ini"
,
b"[global]
\
n
user=yes"
)
content
=
"
\
n
"
.
join
(
"[{}]
\
n
user=yes"
.
format
(
n
)
for
n
in
[
"install"
,
"uninstall"
,
"freeze"
,
"list"
]
)
yield
"pip.ini"
,
(
"pip.ini"
,
content
.
encode
())
def
extract_pip_files
(
ns
):
def
extract_pip_files
(
ns
):
...
...
PC/python_uwp.cpp
View file @
123536fd
...
@@ -122,6 +122,12 @@ set_process_name(PyConfig *config)
...
@@ -122,6 +122,12 @@ set_process_name(PyConfig *config)
break
;
break
;
}
}
}
}
size_t
i
=
executable
.
find_last_of
(
L"/
\\
"
);
if
(
i
==
std
::
wstring
::
npos
)
{
executable
=
PROGNAME
;
}
else
{
executable
.
replace
(
i
+
1
,
std
::
wstring
::
npos
,
PROGNAME
);
}
}
}
if
(
!
home
.
empty
())
{
if
(
!
home
.
empty
())
{
...
@@ -163,10 +169,29 @@ wmain(int argc, wchar_t **argv)
...
@@ -163,10 +169,29 @@ wmain(int argc, wchar_t **argv)
PyPreConfig
preconfig
;
PyPreConfig
preconfig
;
PyConfig
config
;
PyConfig
config
;
const
wchar_t
*
moduleName
=
NULL
;
const
wchar_t
*
p
=
wcsrchr
(
argv
[
0
],
L'\\'
);
if
(
!
p
)
{
p
=
argv
[
0
];
}
if
(
p
)
{
if
(
*
p
==
L'\\'
)
{
p
++
;
}
if
(
wcsnicmp
(
p
,
L"pip"
,
3
)
==
0
)
{
moduleName
=
L"pip"
;
}
else
if
(
wcsnicmp
(
p
,
L"idle"
,
4
)
==
0
)
{
moduleName
=
L"idlelib"
;
}
}
PyPreConfig_InitPythonConfig
(
&
preconfig
);
PyPreConfig_InitPythonConfig
(
&
preconfig
);
status
=
Py_PreInitializeFromArgs
(
&
preconfig
,
argc
,
argv
);
if
(
!
moduleName
)
{
if
(
PyStatus_Exception
(
status
))
{
status
=
Py_PreInitializeFromArgs
(
&
preconfig
,
argc
,
argv
);
goto
fail_without_config
;
if
(
PyStatus_Exception
(
status
))
{
goto
fail_without_config
;
}
}
}
status
=
PyConfig_InitPythonConfig
(
&
config
);
status
=
PyConfig_InitPythonConfig
(
&
config
);
...
@@ -178,48 +203,32 @@ wmain(int argc, wchar_t **argv)
...
@@ -178,48 +203,32 @@ wmain(int argc, wchar_t **argv)
if
(
PyStatus_Exception
(
status
))
{
if
(
PyStatus_Exception
(
status
))
{
goto
fail
;
goto
fail
;
}
}
if
(
moduleName
)
{
config
.
parse_argv
=
0
;
}
status
=
set_process_name
(
&
config
);
status
=
set_process_name
(
&
config
);
if
(
PyStatus_Exception
(
status
))
{
if
(
PyStatus_Exception
(
status
))
{
goto
fail
;
goto
fail
;
}
}
const
wchar_t
*
p
=
_wgetenv
(
L"PYTHONUSERBASE"
);
p
=
_wgetenv
(
L"PYTHONUSERBASE"
);
if
(
!
p
||
!*
p
)
{
if
(
!
p
||
!*
p
)
{
_wputenv_s
(
L"PYTHONUSERBASE"
,
get_user_base
().
c_str
());
_wputenv_s
(
L"PYTHONUSERBASE"
,
get_user_base
().
c_str
());
}
}
p
=
wcsrchr
(
argv
[
0
],
L'\\'
);
if
(
moduleName
)
{
if
(
!
p
)
{
status
=
PyConfig_SetString
(
&
config
,
&
config
.
run_module
,
moduleName
);
p
=
argv
[
0
];
if
(
PyStatus_Exception
(
status
))
{
}
goto
fail
;
if
(
p
)
{
if
(
*
p
==
L'\\'
)
{
p
++
;
}
}
status
=
PyConfig_SetString
(
&
config
,
&
config
.
run_filename
,
NULL
);
const
wchar_t
*
moduleName
=
NULL
;
if
(
PyStatus_Exception
(
status
))
{
if
(
wcsnicmp
(
p
,
L"pip"
,
3
)
==
0
)
{
goto
fail
;
moduleName
=
L"pip"
;
/* No longer required when pip 19.1 is added */
_wputenv_s
(
L"PIP_USER"
,
L"true"
);
}
else
if
(
wcsnicmp
(
p
,
L"idle"
,
4
)
==
0
)
{
moduleName
=
L"idlelib"
;
}
}
status
=
PyConfig_SetString
(
&
config
,
&
config
.
run_command
,
NULL
);
if
(
moduleName
)
{
if
(
PyStatus_Exception
(
status
))
{
status
=
PyConfig_SetString
(
&
config
,
&
config
.
run_module
,
moduleName
);
goto
fail
;
if
(
PyStatus_Exception
(
status
))
{
goto
fail
;
}
status
=
PyConfig_SetString
(
&
config
,
&
config
.
run_filename
,
NULL
);
if
(
PyStatus_Exception
(
status
))
{
goto
fail
;
}
status
=
PyConfig_SetString
(
&
config
,
&
config
.
run_command
,
NULL
);
if
(
PyStatus_Exception
(
status
))
{
goto
fail
;
}
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment