0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 14:13:36 +00:00
termux-packages/packages/pypy3/0003-fix-hardcoded-paths.patch
2024-08-11 14:32:21 +08:00

110 lines
3.4 KiB
Diff

--- a/lib-python/3/aifc.py
+++ b/lib-python/3/aifc.py
@@ -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)
--- a/lib-python/3/mailcap.py
+++ b/lib-python/3/mailcap.py
@@ -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
--- a/lib-python/3/mimetypes.py
+++ b/lib-python/3/mimetypes.py
@@ -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
--- a/lib-python/3/subprocess.py
+++ b/lib-python/3/subprocess.py
@@ -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
--- a/lib-python/3/tempfile.py
+++ b/lib-python/3/tempfile.py
@@ -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:
--- a/lib-python/3/uuid.py
+++ b/lib-python/3/uuid.py
@@ -361,7 +361,7 @@
try:
path_dirs = os.environ.get('PATH', os.defpath).split(os.pathsep)
- path_dirs.extend(['/sbin', '/usr/sbin'])
+ path_dirs.extend(['@TERMUX_PREFIX@/bin'])
executable = shutil.which(command, path=os.pathsep.join(path_dirs))
if executable is None:
return None
--- a/lib-python/3/posixpath.py
+++ b/lib-python/3/posixpath.py
@@ -18,7 +18,7 @@
extsep = '.'
sep = '/'
pathsep = ':'
-defpath = '/bin:/usr/bin'
+defpath = ':@TERMUX_PREFIX@/bin'
altsep = None
devnull = '/dev/null'
--- a/lib-python/3/multiprocessing/heap.py
+++ b/lib-python/3/multiprocessing/heap.py
@@ -70,7 +70,7 @@
"""
if sys.platform == 'linux':
- _dir_candidates = ['/dev/shm']
+ _dir_candidates = ['/dev/shm']
else:
_dir_candidates = []
--- a/lib_pypy/_tkinter/tklib_build.py
+++ b/lib_pypy/_tkinter/tklib_build.py
@@ -26,6 +26,10 @@
if homebrew:
incdirs.append(homebrew + '/include')
libdirs.append(homebrew + '/opt/tcl-tk/lib')
+elif os.path.exists("@TERMUX_PREFIX@"):
+ incdirs = ["@TERMUX_PREFIX@/include"]
+ libdirs = ["@TERMUX_PREFIX@/lib"]
+ linklibs = ['tcl8.6', 'tk8.6']
else:
# On some Linux distributions, the tcl and tk libraries are
# stored in /usr/include, so we must check this case also