mirror of
https://github.com/ivabus/pantry
synced 2024-11-23 00:45:07 +03:00
[python] use tea defaults for install locations (#816)
This commit is contained in:
parent
56fe020439
commit
c5759405f7
4 changed files with 47 additions and 74 deletions
|
@ -15,10 +15,7 @@ runtime:
|
|||
build:
|
||||
dependencies:
|
||||
curl.se: '*'
|
||||
gnu.org/patch: '*'
|
||||
script: |
|
||||
patch -p1 <props/user-install.patch
|
||||
|
||||
curl -O https://bootstrap.pypa.io/get-pip.py
|
||||
|
||||
test -d bootstrap || mkdir bootstrap
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
diff --git a/src/pip/_internal/commands/configuration.py b/src/pip/_internal/commands/configuration.py
|
||||
index 84b134e..c7e6775 100644
|
||||
--- a/src/pip/_internal/commands/configuration.py
|
||||
+++ b/src/pip/_internal/commands/configuration.py
|
||||
@@ -79,7 +79,7 @@ class ConfigurationCommand(Command):
|
||||
"--user",
|
||||
dest="user_file",
|
||||
action="store_true",
|
||||
- default=False,
|
||||
+ default=True,
|
||||
help="Use the user configuration file only",
|
||||
)
|
||||
|
||||
diff --git a/src/pip/_internal/commands/freeze.py b/src/pip/_internal/commands/freeze.py
|
||||
index 5fa6d39..e7f5891 100644
|
||||
--- a/src/pip/_internal/commands/freeze.py
|
||||
+++ b/src/pip/_internal/commands/freeze.py
|
||||
@@ -51,7 +51,7 @@ class FreezeCommand(Command):
|
||||
"--user",
|
||||
dest="user",
|
||||
action="store_true",
|
||||
- default=False,
|
||||
+ default=True,
|
||||
help="Only output packages installed in user-site.",
|
||||
)
|
||||
self.cmd_opts.add_option(cmdoptions.list_path())
|
||||
diff --git a/src/pip/_internal/commands/inspect.py b/src/pip/_internal/commands/inspect.py
|
||||
index 27c8fa3..6058356 100644
|
||||
--- a/src/pip/_internal/commands/inspect.py
|
||||
+++ b/src/pip/_internal/commands/inspect.py
|
||||
@@ -39,7 +39,7 @@ class InspectCommand(Command):
|
||||
"--user",
|
||||
dest="user",
|
||||
action="store_true",
|
||||
- default=False,
|
||||
+ default=True,
|
||||
help="Only output packages installed in user-site.",
|
||||
)
|
||||
self.cmd_opts.add_option(cmdoptions.list_path())
|
||||
diff --git a/src/pip/_internal/commands/install.py b/src/pip/_internal/commands/install.py
|
||||
index b20aedd..d2151e0 100644
|
||||
--- a/src/pip/_internal/commands/install.py
|
||||
+++ b/src/pip/_internal/commands/install.py
|
||||
@@ -129,6 +129,7 @@ class InstallCommand(RequirementCommand):
|
||||
"--user",
|
||||
dest="use_user_site",
|
||||
action="store_true",
|
||||
+ default=True,
|
||||
help=(
|
||||
"Install to the Python user install directory for your "
|
||||
"platform. Typically ~/.local/, or %APPDATA%\\Python on "
|
||||
diff --git a/src/pip/_internal/commands/list.py b/src/pip/_internal/commands/list.py
|
||||
index 8e1426d..1e269dc 100644
|
||||
--- a/src/pip/_internal/commands/list.py
|
||||
+++ b/src/pip/_internal/commands/list.py
|
||||
@@ -83,7 +83,7 @@ class ListCommand(IndexGroupCommand):
|
||||
"--user",
|
||||
dest="user",
|
||||
action="store_true",
|
||||
- default=False,
|
||||
+ default=True,
|
||||
help="Only output packages installed in user-site.",
|
||||
)
|
||||
self.cmd_opts.add_option(cmdoptions.list_path())
|
|
@ -53,6 +53,9 @@ build:
|
|||
make --jobs {{ hw.concurrency }}
|
||||
make install
|
||||
|
||||
# customize `pip install` locations to tea defaults
|
||||
cp props/sitecustomize.py {{prefix}}/lib/python{{version.marketing}}
|
||||
|
||||
# provide unversioned symlinks
|
||||
cd {{prefix}}/bin
|
||||
for x in python idle pydoc; do
|
||||
|
@ -60,6 +63,11 @@ build:
|
|||
done
|
||||
ln -sf python{{ version.marketing }}-config python-config
|
||||
|
||||
# we provide the binaries in a separate package
|
||||
# but we don’t use --without-ensurepip because stuff expects python to
|
||||
# come bundled with setuptools
|
||||
rm pip*
|
||||
|
||||
# older versions use a different config dir
|
||||
if semverator satisfies '<3.8' {{ version }}; then
|
||||
confdir=$(echo $confdir | sed -e 's/\(config-{{ version.marketing }}\)/\1m/')
|
||||
|
@ -76,11 +84,6 @@ build:
|
|||
sed -i.bak -e 's|{{ prefix }}|\\$(shell tea --prefix)/python.org/v{{version.major}}|g' $confdir/Makefile
|
||||
rm $confdir/Makefile.bak
|
||||
|
||||
# we provide the binaries in a separate package
|
||||
# but we don’t use --without-ensurepip because stuff expects python to
|
||||
# come bundled with setuptools
|
||||
rm {{prefix}}/bin/pip*
|
||||
|
||||
env:
|
||||
ARGS:
|
||||
- --prefix="{{ prefix }}"
|
||||
|
@ -129,6 +132,31 @@ build:
|
|||
# be assumed that no additional -I,-L directives are needed.
|
||||
|
||||
test:
|
||||
#TODO test all modules eg zlib module
|
||||
script: |
|
||||
python --version
|
||||
# Check if sqlite is ok, because we build with --enable-loadable-sqlite-extensions
|
||||
# and it can occur that building sqlite silently fails if OSX's sqlite is used.
|
||||
python -c "import sqlite3"
|
||||
|
||||
# check to see if we can create a venv
|
||||
python -m venv myvenv
|
||||
|
||||
# Check if some other modules import. Then the linked libs are working.
|
||||
python -c "import _ctypes"
|
||||
# python -c "import _decimal" #FIXME
|
||||
python -c "import pyexpat"
|
||||
python -c "import zlib"
|
||||
|
||||
# Verify that the selected DBM interface works
|
||||
python $FIXTURE
|
||||
|
||||
if which pip; then
|
||||
exit 1
|
||||
fi
|
||||
fixture: |
|
||||
import dbm
|
||||
with dbm.ndbm.open("test", "c") as db:
|
||||
db[b"foo \\xbd"] = b"bar \\xbd"
|
||||
with dbm.ndbm.open("test", "r") as db:
|
||||
assert list(db.keys()) == [b"foo \\xbd"]
|
||||
assert b"foo \\xbd" in db
|
||||
assert db[b"foo \\xbd"] == b"bar \\xbd"
|
12
projects/python.org/sitecustomize.py
Normal file
12
projects/python.org/sitecustomize.py
Normal file
|
@ -0,0 +1,12 @@
|
|||
import site
|
||||
import sys
|
||||
|
||||
# tea considers /usr/local the “πglobal install” location
|
||||
# setting this is kinda nuts but brew does the same so
|
||||
# we’re assuming they vetted all options
|
||||
sys.prefix = "/usr/local"
|
||||
|
||||
# enable automatic user installs if pip makes the decision
|
||||
# that this is good idea. eg. if /usr/local isn’t writable
|
||||
# this is what it will do
|
||||
site.ENABLE_USER_SITE = True
|
Loading…
Reference in a new issue