python (python3) replaces python2
https://github.com/upx/upx/issues/868 Thanks to 'tansy' for the patches to *.py . modified: .github/workflows/ci.yml modified: src/stub/scripts/bin2h.py modified: src/stub/scripts/brandelf.py modified: src/stub/scripts/gpp_inc.py modified: src/stub/scripts/xstrip.py modified: src/stub/src/arch/i086/cleanasm.py modified: src/stub/src/arch/i086/wdis2gas.py
This commit is contained in:
parent
3c3caaa567
commit
36271c3244
14
.github/workflows/ci.yml
vendored
14
.github/workflows/ci.yml
vendored
@ -41,12 +41,14 @@ jobs:
|
||||
apt-get update && apt-get upgrade -y
|
||||
# install system packages
|
||||
apt-get install -y --no-install-recommends bash ca-certificates curl git libmpc3 make perl-base tar time xz-utils libc6:i386 zlib1g:i386
|
||||
# install python2-minimal packages from Debian-11
|
||||
mkdir ../deps; cd ../deps; mkdir packages
|
||||
curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb
|
||||
curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb
|
||||
dpkg -i ./*python2*.deb && rm ./*python2*.deb && ldconfig
|
||||
ln -s -v python2.7 /usr/bin/python2
|
||||
#
|
||||
### install python2-minimal packages from Debian-11
|
||||
## mkdir ../deps; cd ../deps; mkdir packages
|
||||
## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/libpython2.7-minimal_2.7.18-8+deb11u1_amd64.deb
|
||||
## curl -sS -L -O https://ftp.debian.org/debian/pool/main/p/python2.7/python2.7-minimal_2.7.18-8+deb11u1_amd64.deb
|
||||
## dpkg -i ./*python2*.deb && rm ./*python2*.deb && ldconfig
|
||||
## ln -s -v python2.7 /usr/bin/python2
|
||||
#
|
||||
# manually unpack and install compat libs from Ubuntu-16.04
|
||||
curl -sS -L -O https://archive.kernel.org/ubuntu-archive/ubuntu/pool/main/m/mpfr4/libmpfr4_3.1.6-1_amd64.deb
|
||||
for f in ./*.deb; do dpkg -x $f ./packages; done
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python2
|
||||
#! /usr/bin/env python
|
||||
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||
#
|
||||
# bin2h.py --
|
||||
@ -133,7 +133,7 @@ class _DataWriter_gas_u32(DataWriter):
|
||||
w(",")
|
||||
v = struct.unpack(self.DECODE, data[i:i+4])
|
||||
assert len(v) == 1, v
|
||||
w("0x%08x" % (v[0] & 0xffffffffL))
|
||||
w("0x%08x" % (v[0] & 0xffffffff))
|
||||
self.w_eol()
|
||||
|
||||
class DataWriter_gas_be32(_DataWriter_gas_u32):
|
||||
@ -170,8 +170,8 @@ class DataWriter_nasm(DataWriter):
|
||||
|
||||
def w_checksum_c(w, s, data):
|
||||
w("#define %s_SIZE %d\n" % (s, len(data)))
|
||||
w("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffffL & zlib.adler32(data)))
|
||||
w("#define %s_CRC32 0x%08x\n" % (s, 0xffffffffL & zlib.crc32(data)))
|
||||
w("#define %s_ADLER32 0x%08x\n" % (s, 0xffffffff & zlib.adler32(data)))
|
||||
w("#define %s_CRC32 0x%08x\n" % (s, 0xffffffff & zlib.crc32(data)))
|
||||
w("\n")
|
||||
|
||||
|
||||
@ -293,10 +293,10 @@ def main(argv):
|
||||
# check file size
|
||||
st = os.stat(ifile)
|
||||
if 1 and st.st_size <= 0:
|
||||
print >> sys.stderr, "%s: ERROR: empty file" % (ifile)
|
||||
sys.stderr.write("%s: ERROR: empty file\n" % (ifile))
|
||||
sys.exit(1)
|
||||
if 1 and st.st_size > 128*1024:
|
||||
print >> sys.stderr, "%s: ERROR: file is too big (%d bytes)" % (ifile, st.st_size)
|
||||
sys.stderr.write("%s: ERROR: file is too big (%d bytes)\n" % (ifile, st.st_size))
|
||||
sys.exit(1)
|
||||
|
||||
# read ifile
|
||||
@ -333,7 +333,7 @@ def main(argv):
|
||||
mdata.append(method)
|
||||
assert len(mdata) >= 1
|
||||
mdata.reverse()
|
||||
##print opts.methods, [(i, len(mdata_odata[i])) for i in mdata]
|
||||
##print (opts.methods, [(i, len(mdata_odata[i])) for i in mdata])
|
||||
|
||||
# write ofile
|
||||
if opts.dry_run:
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python2
|
||||
#! /usr/bin/env python
|
||||
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||
#
|
||||
# brandelf.py --
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python2
|
||||
#! /usr/bin/env python
|
||||
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||
#
|
||||
# gpp_inc.py -- Generic PreProcessor: include
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python2
|
||||
#! /usr/bin/env python
|
||||
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||
#
|
||||
# xstrip.py -- truncate ELF objects created by multiarch-objcopy-2.17
|
||||
@ -54,9 +54,9 @@ def strip_with_dump(dump_fn, eh, idata):
|
||||
sh_size = int("0x" + f[2], 16)
|
||||
if sh_offset + sh_size > new_len:
|
||||
new_len = sh_offset + sh_size
|
||||
##print sh_offset, sh_size, f
|
||||
##print (sh_offset, sh_size, f)
|
||||
if new_len > len(eh):
|
||||
##print dump_fn, new_len
|
||||
##print (dump_fn, new_len)
|
||||
return eh, idata[:new_len-len(eh)]
|
||||
return eh, idata
|
||||
|
||||
@ -91,7 +91,7 @@ def check_dump(dump_fn):
|
||||
assert not section_names.has_key(e[0]), e
|
||||
assert not e[0].endswith(":"), ("bad section name", e)
|
||||
section_names[e[0]] = e
|
||||
##print sections
|
||||
##print (sections)
|
||||
# preprocessSymbols
|
||||
symbols = []
|
||||
section = None
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python2
|
||||
#! /usr/bin/env python
|
||||
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||
#
|
||||
# cleanasm.py --
|
||||
@ -135,7 +135,7 @@ def main(argv):
|
||||
pos += sgn(mlen)
|
||||
if mlen < 0:
|
||||
mpos.reverse()
|
||||
if debug and 1: print mlen, m, [olines[x] for x in mpos]
|
||||
if debug and 1: print (mlen, m, [olines[x] for x in mpos])
|
||||
dpos = []
|
||||
i = -abs(mlen)
|
||||
while i < 0:
|
||||
@ -404,7 +404,7 @@ def main(argv):
|
||||
assert len(r) == len(dpos)
|
||||
pos = pos0
|
||||
for inst, args in r:
|
||||
##print pos-pos0, inst, args
|
||||
##print (pos-pos0, inst, args)
|
||||
olines[pos][1] = inst
|
||||
olines[pos][2] = args
|
||||
pos += 1
|
||||
@ -438,7 +438,7 @@ def main(argv):
|
||||
if v[:2] == [1, 2]: # external 2-byte
|
||||
x = inline_map.get(v[2])
|
||||
if x and v[3] <= x[1]: # max. number of calls
|
||||
##print "inline", v, x
|
||||
##print ("inline", v, x)
|
||||
if x:
|
||||
olines[i][1] = x[0]
|
||||
olines[i][2] = "/* inlined */"
|
||||
@ -478,7 +478,7 @@ def main(argv):
|
||||
l = "%8s%-7s %s" % ("", inst, args)
|
||||
ofp.write(l.rstrip() + "\n")
|
||||
ofp.close()
|
||||
##print olines
|
||||
##print (olines)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#! /usr/bin/env python2
|
||||
#! /usr/bin/env python
|
||||
## vim:set ts=4 sw=4 et: -*- coding: utf-8 -*-
|
||||
#
|
||||
# wdis2gas.py --
|
||||
@ -138,7 +138,7 @@ def main(argv):
|
||||
for l in olines:
|
||||
ofp.write(l.rstrip() + "\n")
|
||||
ofp.close()
|
||||
##print olines
|
||||
##print (olines)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
Loading…
Reference in New Issue
Block a user