0
0
mirror of https://github.com/termux/termux-packages.git synced 2024-12-12 00:10:52 +00:00
termux-packages/packages/pypy/0003-fix-hardcoded-paths.patch
2024-08-03 00:20:29 +08:00

96 lines
2.8 KiB
Diff

--- a/lib-python/2.7/aifc.py
+++ b/lib-python/2.7/aifc.py
@@ -971,7 +971,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]
f = open(fn, 'r')
try:
--- a/lib-python/2.7/mailcap.py
+++ b/lib-python/2.7/mailcap.py
@@ -44,7 +44,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/2.7/mimetypes.py
+++ b/lib-python/2.7/mimetypes.py
@@ -47,6 +47,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/2.7/subprocess.py
+++ b/lib-python/2.7/subprocess.py
@@ -941,7 +941,7 @@
args = list(args)
if shell:
- args = ["/bin/sh", "-c"] + args
+ args = ["@TERMUX_PREFIX@/bin/sh", "-c"] + args
if executable:
args[0] = executable
--- a/lib-python/2.7/tempfile.py
+++ b/lib-python/2.7/tempfile.py
@@ -163,7 +163,7 @@
elif _os.name == 'nt':
dirlist.extend([ 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/2.7/uuid.py
+++ b/lib-python/2.7/uuid.py
@@ -314,7 +314,7 @@
def _popen(command, args):
import os
path = os.environ.get("PATH", os.defpath).split(os.pathsep)
- path.extend(('/sbin', '/usr/sbin'))
+ path.extend(('@TERMUX_PREFIX@/bin',))
for dir in path:
executable = os.path.join(dir, command)
if (os.path.exists(executable) and
--- a/lib-python/2.7/posixpath.py
+++ b/lib-python/2.7/posixpath.py
@@ -32,7 +32,7 @@
extsep = '.'
sep = '/'
pathsep = ':'
-defpath = ':/bin:/usr/bin'
+defpath = ':@TERMUX_PREFIX@/bin'
altsep = None
devnull = '/dev/null'
--- 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