Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 7c3d29f

Browse filesBrowse files
authored
fix: use --upgrade rather than --ignore-installed to upgrade pip (#268)
* fix: use `--upgrade` rather than `--ignore-installed` to upgrade pip This removes left over files when upgrading pip. * remove all installed python on macOS
1 parent c03f98f commit 7c3d29f
Copy full SHA for 7c3d29f

File tree

Expand file treeCollapse file tree

5 files changed

+35
-2
lines changed
Filter options
Expand file treeCollapse file tree

5 files changed

+35
-2
lines changed

‎.github/workflows/build-python-packages.yml

Copy file name to clipboardExpand all lines: .github/workflows/build-python-packages.yml
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ jobs:
105105
- name: Fully cleanup the toolcache directory before testing
106106
run: ./helpers/clean-toolcache.ps1 -ToolName "Python"
107107

108+
- name: Delete macOS /Library/Frameworks/Python.framework
109+
if: matrix.platform == 'darwin'
110+
shell: bash
111+
run: if [ -d /Library/Frameworks/Python.framework ]; then sudo rm -rf /Library/Frameworks/Python.framework; fi
112+
108113
- name: Download artifact
109114
uses: actions/download-artifact@v3
110115
with:

‎installers/macos-pkg-setup-template.sh

Copy file name to clipboardExpand all lines: installers/macos-pkg-setup-template.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ chmod +x ../python $PYTHON_MAJOR $PYTHON_MAJOR_DOT_MINOR $PYTHON_MAJOR_MINOR pyt
7171
echo "Upgrading pip..."
7272
export PIP_ROOT_USER_ACTION=ignore
7373
./python -m ensurepip
74-
./python -m pip install --ignore-installed pip --disable-pip-version-check --no-warn-script-location
74+
./python -m pip install --upgrade pip --disable-pip-version-check --no-warn-script-location
7575

7676
echo "Install OpenSSL certificates"
7777
sh -e "${PYTHON_APPLICATION_PATH}/Install Certificates.command"

‎installers/nix-setup-template.sh

Copy file name to clipboardExpand all lines: installers/nix-setup-template.sh
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ chmod +x ../python $PYTHON_MAJOR $PYTHON_MAJOR_DOT_MINOR $PYTHON_MAJORMINOR pyth
5151
echo "Upgrading pip..."
5252
export PIP_ROOT_USER_ACTION=ignore
5353
./python -m ensurepip
54-
./python -m pip install --ignore-installed pip --disable-pip-version-check --no-warn-script-location
54+
./python -m pip install --upgrade pip --disable-pip-version-check --no-warn-script-location
5555

5656
echo "Create complete file"
5757
touch $PYTHON_TOOLCACHE_VERSION_PATH/x64.complete

‎tests/python-tests.ps1

Copy file name to clipboardExpand all lines: tests/python-tests.ps1
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,8 @@ Describe "Tests" {
103103
It "Check urlopen with HTTPS works" {
104104
"python ./sources/python-urlopen-https.py" | Should -ReturnZeroExitCode
105105
}
106+
107+
It "Check a single dist-info per distribution is present" {
108+
"python ./sources/dist-info.py" | Should -ReturnZeroExitCode
109+
}
106110
}

‎tests/sources/dist-info.py

Copy file name to clipboard
+24Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import glob
2+
import os.path
3+
import sysconfig
4+
from collections import defaultdict
5+
6+
7+
def check_dist_info():
8+
paths = set([sysconfig.get_path("purelib"), sysconfig.get_path("platlib")])
9+
versions = defaultdict(list)
10+
for path in paths:
11+
pattern = os.path.join(path, "*.dist-info")
12+
for dist_info in glob.glob(pattern):
13+
name = os.path.basename(dist_info).split("-", maxsplit=1)[0]
14+
versions[name].append(dist_info)
15+
exit_code = 0
16+
for name in versions:
17+
if len(versions[name]) > 1:
18+
print("multiple dist-info found for {}: {}".format(name, versions[name]))
19+
exit_code = 1
20+
exit(exit_code)
21+
22+
23+
if __name__ == "__main__":
24+
check_dist_info()

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.