From b60808a930c9169a92116febadb1a80a60aa715a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Mon, 28 Nov 2022 23:52:56 +0700 Subject: [PATCH] 0ad: patch for Python 3.11 --- srcpkgs/0ad/files/python-3.11.patch | 81 +++++++++++++++++++++++++++ srcpkgs/0ad/patches/python-3.11.patch | 11 ++++ srcpkgs/0ad/template | 11 +++- 3 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 srcpkgs/0ad/files/python-3.11.patch create mode 100644 srcpkgs/0ad/patches/python-3.11.patch diff --git a/srcpkgs/0ad/files/python-3.11.patch b/srcpkgs/0ad/files/python-3.11.patch new file mode 100644 index 000000000000..3cb99d542f12 --- /dev/null +++ b/srcpkgs/0ad/files/python-3.11.patch @@ -0,0 +1,81 @@ +From 95f1e91ef71d912be5f6dddb6fac68671d850fd6 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Franti=C5=A1ek=20Zatloukal?= +Date: Sun, 24 Jul 2022 11:11:01 +0200 +Subject: [PATCH] Python/Build: Use r instead of rU file read modes + +Fixes Python 3.11 build +--- + python/mozbuild/mozbuild/action/process_define_files.py | 2 +- + python/mozbuild/mozbuild/preprocessor.py | 6 +++--- + python/mozbuild/mozbuild/util.py | 4 +++- + 3 files changed, 7 insertions(+), 5 deletions(-) + +diff --git a/python/mozbuild/mozbuild/action/process_define_files.py b/python/mozbuild/mozbuild/action/process_define_files.py +index 6fff0d1..de2bcf4 100644 +--- a/python/mozbuild/mozbuild/action/process_define_files.py ++++ b/python/mozbuild/mozbuild/action/process_define_files.py +@@ -36,7 +36,7 @@ def process_define_file(output, input): + not config.substs.get('JS_STANDALONE'): + config = PartialConfigEnvironment(mozpath.join(topobjdir, 'js', 'src')) + +- with open(path, 'rU') as input: ++ with open(path, 'r') as input: + r = re.compile('^\s*#\s*(?P[a-z]+)(?:\s+(?P\S+)(?:\s+(?P\S+))?)?', re.U) + for l in input: + m = r.match(l) +diff --git a/python/mozbuild/mozbuild/preprocessor.py b/python/mozbuild/mozbuild/preprocessor.py +index 0e3a750..66f5cf7 100644 +--- a/python/mozbuild/mozbuild/preprocessor.py ++++ b/python/mozbuild/mozbuild/preprocessor.py +@@ -517,7 +517,7 @@ class Preprocessor: + + if args: + for f in args: +- with io.open(f, 'rU', encoding='utf-8') as input: ++ with io.open(f, 'r', encoding='utf-8') as input: + self.processFile(input=input, output=out) + if depfile: + mk = Makefile() +@@ -807,7 +807,7 @@ class Preprocessor: + args = self.applyFilters(args) + if not os.path.isabs(args): + args = os.path.join(self.curdir, args) +- args = io.open(args, 'rU', encoding='utf-8') ++ args = io.open(args, 'r', encoding='utf-8') + except Preprocessor.Error: + raise + except Exception: +@@ -862,7 +862,7 @@ def preprocess(includes=[sys.stdin], defines={}, + pp = Preprocessor(defines=defines, + marker=marker) + for f in includes: +- with io.open(f, 'rU', encoding='utf-8') as input: ++ with io.open(f, 'r', encoding='utf-8') as input: + pp.processFile(input=input, output=output) + return pp.includes + +diff --git a/python/mozbuild/mozbuild/util.py b/python/mozbuild/mozbuild/util.py +index 044cf64..eb992ce 100644 +--- a/python/mozbuild/mozbuild/util.py ++++ b/python/mozbuild/mozbuild/util.py +@@ -54,6 +54,8 @@ def exec_(object, globals=None, locals=None): + + + def _open(path, mode): ++ if mode == "rU": ++ mode = "r" + if 'b' in mode: + return io.open(path, mode) + return io.open(path, mode, encoding='utf-8', newline='\n') +@@ -220,7 +222,7 @@ class FileAvoidWrite(BytesIO): + still occur, as well as diff capture if requested. + """ + +- def __init__(self, filename, capture_diff=False, dry_run=False, readmode='rU'): ++ def __init__(self, filename, capture_diff=False, dry_run=False, readmode='r'): + BytesIO.__init__(self) + self.name = filename + assert type(capture_diff) == bool +-- +2.37.1 + diff --git a/srcpkgs/0ad/patches/python-3.11.patch b/srcpkgs/0ad/patches/python-3.11.patch new file mode 100644 index 000000000000..d213bd4c2d07 --- /dev/null +++ b/srcpkgs/0ad/patches/python-3.11.patch @@ -0,0 +1,11 @@ +Index: 0ad-0.0.26/libraries/source/spidermonkey/patch.sh +=================================================================== +--- 0ad-0.0.26.orig/libraries/source/spidermonkey/patch.sh ++++ 0ad-0.0.26/libraries/source/spidermonkey/patch.sh +@@ -85,3 +85,6 @@ then + # https://svnweb.freebsd.org/ports/head/lang/spidermonkey78/files/patch-third__party_rust_cc_src_lib.rs?view=log + patch -p1 < ../FixFreeBSDRustThirdPartyOSDetection.diff + fi ++ ++patch -p1 <../python-3.11.patch ++patch -p1 <../1654457-virtualenv.patch diff --git a/srcpkgs/0ad/template b/srcpkgs/0ad/template index 38039b475ef2..147c4277b99f 100644 --- a/srcpkgs/0ad/template +++ b/srcpkgs/0ad/template @@ -12,11 +12,15 @@ short_desc="Historically-based real-time strategy game" maintainer="Helmut Pozimski " license="GPL-2.0-or-later, CC-BY-SA-3.0, MPL-2.0, MIT" homepage="https://play0ad.com" -distfiles="https://releases.wildfiregames.com/${pkgname}-${version}-alpha-unix-build.tar.xz" -checksum=2e1c6df7e3312e77c5f82788664cffc3a78d3bf60606c00039275e1d13c0ee4b +distfiles="https://releases.wildfiregames.com/${pkgname}-${version}-alpha-unix-build.tar.xz + https://github.com/mozilla/gecko-dev/commit/38543a6397c499743baeeab0a44d2b827f8a716b.patch>1654457-virtualenv.patch" +checksum="2e1c6df7e3312e77c5f82788664cffc3a78d3bf60606c00039275e1d13c0ee4b + 0a44cebd9399ba742e7cb79a255a55caf8af19712baff21d009ef25a9619cb2e" nocross="uses bundled third-party libraries that do not cross-compile" lib32disabled=yes +skip_extraction="1654457-virtualenv.patch" + CXXFLAGS="-fpermissive" # Use BFD linker to avoid erroneous detection of llvm pr8927 with *-musl LDFLAGS="-fuse-ld=bfd" @@ -32,6 +36,9 @@ post_patch() { echo "TARGET_LINK_LIBRARIES(nvcore execinfo)" >> \ libraries/source/nvtt/src/src/nvcore/CMakeLists.txt fi + cp ${FILESDIR}/python-3.11.patch libraries/source/spidermonkey/ + cp ${XBPS_SRCDISTDIR}/${pkgname}-${version}/1654457-virtualenv.patch \ + libraries/source/spidermonkey/ } do_configure() {