termux-packages/packages/pypy3/fix-hardcoded-pathes.patch
2022-03-20 04:03:22 +09:00

93 lines
4.2 KiB
Diff

diff -uNr pypy3.7-v7.3.7-src/lib-python/3/aifc.py pypy3.7-v7.3.7-src.mod/lib-python/3/aifc.py
--- pypy3.7-v7.3.7-src/lib-python/3/aifc.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/aifc.py 2022-01-17 23:55:55.258202300 +0800
@@ -928,7 +928,7 @@
if __name__ == '__main__':
import sys
if not sys.argv[1:]:
- sys.argv.append('/usr/demos/data/audio/bach.aiff')
+ sys.argv.append('@TERMUX_PREFIX@/demos/data/audio/bach.aiff')
fn = sys.argv[1]
with open(fn, 'r') as f:
print("Reading", fn)
diff -uNr pypy3.7-v7.3.7-src/lib-python/3/mailcap.py pypy3.7-v7.3.7-src.mod/lib-python/3/mailcap.py
--- pypy3.7-v7.3.7-src/lib-python/3/mailcap.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/mailcap.py 2022-01-17 23:59:02.757448900 +0800
@@ -55,7 +55,8 @@
# Don't bother with getpwuid()
home = '.' # Last resort
mailcaps = [home + '/.mailcap', '/etc/mailcap',
- '/usr/etc/mailcap', '/usr/local/etc/mailcap']
+ '/usr/etc/mailcap', '/usr/local/etc/mailcap',
+ '@TERMUX_PREFIX@/etc/mailcap']
return mailcaps
diff -uNr pypy3.7-v7.3.7-src/lib-python/3/mimetypes.py pypy3.7-v7.3.7-src.mod/lib-python/3/mimetypes.py
--- pypy3.7-v7.3.7-src/lib-python/3/mimetypes.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/mimetypes.py 2022-01-18 00:02:08.526252600 +0800
@@ -49,6 +49,7 @@
"/usr/local/lib/netscape/mime.types",
"/usr/local/etc/httpd/conf/mime.types", # Apache 1.2
"/usr/local/etc/mime.types", # Apache 1.3
+ "@TERMUX_PREFIX@/etc/mime.types", # Termux
]
inited = False
diff -uNr pypy3.7-v7.3.7-src/lib-python/3/subprocess.py pypy3.7-v7.3.7-src.mod/lib-python/3/subprocess.py
--- pypy3.7-v7.3.7-src/lib-python/3/subprocess.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/subprocess.py 2022-01-17 22:27:32.546765900 +0800
@@ -1452,9 +1452,7 @@
args = list(args)
if shell:
- # On Android the default shell is at '/system/bin/sh'.
- unix_shell = ('/system/bin/sh' if
- hasattr(sys, 'getandroidapilevel') else '/bin/sh')
+ unix_shell = ('@TERMUX_PREFIX@/bin/sh')
args = [unix_shell, "-c"] + args
if executable:
args[0] = executable
diff -uNr pypy3.7-v7.3.7-src/lib-python/3/tempfile.py pypy3.7-v7.3.7-src.mod/lib-python/3/tempfile.py
--- pypy3.7-v7.3.7-src/lib-python/3/tempfile.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/tempfile.py 2022-01-17 22:43:01.156251700 +0800
@@ -173,7 +173,7 @@
_os.path.expandvars(r'%SYSTEMROOT%\Temp'),
r'c:\temp', r'c:\tmp', r'\temp', r'\tmp' ])
else:
- dirlist.extend([ '/tmp', '/var/tmp', '/usr/tmp' ])
+ dirlist.extend([ '@TERMUX_PREFIX@/tmp' ])
# As a last resort, the current directory.
try:
diff -uNr pypy3.7-v7.3.7-src/lib-python/3/uuid.py pypy3.7-v7.3.7-src.mod/lib-python/3/uuid.py
--- pypy3.7-v7.3.7-src/lib-python/3/uuid.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/uuid.py 2022-01-18 00:07:51.455919700 +0800
@@ -362,7 +362,7 @@
import os, shutil, subprocess
executable = shutil.which(command)
if executable is None:
- path = os.pathsep.join(('/sbin', '/usr/sbin'))
+ path = os.pathsep.join(('@TERMUX_PREFIX@/bin',))
executable = shutil.which(command, path=path)
if executable is None:
return None
diff -uNr pypy3.7-v7.3.7-src/lib-python/3/posixpath.py pypy3.7-v7.3.7-src.mod/lib-python/3/posixpath.py
--- pypy3.7-v7.3.7-src/lib-python/3/posixpath.py 2021-10-24 22:07:11.000000000 +0800
+++ pypy3.7-v7.3.7-src.mod/lib-python/3/posixpath.py 2022-01-18 00:05:03.938325200 +0800
@@ -18,7 +18,7 @@
extsep = '.'
sep = '/'
pathsep = ':'
-defpath = '/bin:/usr/bin'
+defpath = ':@TERMUX_PREFIX@/bin'
altsep = None
devnull = '/dev/null'