Created attachment 210342 [details] Proposed patch (since 520894 revision) Patch to fix build with using Python 3.x for games/oolite port (v1.88). - Use cached Python path for configure on build stage - Use 2to3 script to convert required *.py scripts from 2 to 3 version
Created attachment 210343 [details] Proposed patch (since 520894 revision) Changed PREFIX to LOCALBASE for 2to3 path.
@lightside Thank you for the patch Could you please: - Submit this patch upstream as an issue or pull request, and include the issue/PR URL in the See Also field - Confirm that this change passes QA (poudriere) Also, if you are able to, and in order to ensure games/oolite remains available and usable by users, consider maintaining this port. Please include an update to the MAINTAINER line if you can
Created attachment 210354 [details] Proposed patch (since 520894 revision) - Cosmetic changes. Hello, Kubilay Kocak. (In reply to Kubilay Kocak from comment #2) > Could you please: > > - Submit this patch upstream as an issue or pull request, and include the > issue/PR URL in the See Also field Sorry, but I can't (or not interested). There is no patch. There are only (temporary) dynamic changes with using 2to3 script, provided by Python installation. But if remove "--no-diffs" option for invocation of 2to3 script, it shows changes for usage of print function: -8<-- RefactoringTool: Skipping optional fixer: buffer RefactoringTool: Skipping optional fixer: idioms RefactoringTool: Skipping optional fixer: set_literal RefactoringTool: Skipping optional fixer: ws_comma RefactoringTool: Refactored imacro_asm.py --- imacro_asm.py (original) +++ imacro_asm.py (refactored) @@ -456,7 +456,7 @@ if __name__ == '__main__': import sys if len(sys.argv) != 3: - print "usage: python imacro_asm.py infile.jsasm outfile.c.out" + print("usage: python imacro_asm.py infile.jsasm outfile.c.out") sys.exit(1) f = open(sys.argv[2], 'w') RefactoringTool: Refactored build/cl.py --- build/cl.py (original) +++ build/cl.py (refactored) @@ -51,7 +51,7 @@ break if target == None: - print >>sys.stderr, "No target set" and sys.exit(1) + print("No target set" and sys.exit(1), file=sys.stderr) # The deps target lives here depstarget = os.path.basename(target) + ".pp" @@ -90,7 +90,7 @@ f = open(depstarget, "w") for dep in sorted(deps): - print >>f, "%s: %s" % (target, dep) + print("%s: %s" % (target, dep), file=f) if __name__ == "__main__": InvokeClWithDependencyGeneration(sys.argv[1:]) RefactoringTool: Files that were modified: RefactoringTool: imacro_asm.py RefactoringTool: build/cl.py -->8- Also, the custom version of SpyderMonkey is just a external dependency for OOlite, if looking for source code: https://github.com/OoliteProject/oolite/tree/1.88/deps https://github.com/OoliteProject/spidermonkey-ff4/blob/ca2fb5423fab4d72a3dc5fec911ce20bda01f223/README.txt I guess, if developers may want to support Python 3.x version, they can do this with using 2to3 script, if needed. There is no defect and it normally works with using Python 2.x version. This is just a build dependency. > - Confirm that this change passes QA (poudriere) It passes build with using Python 3.x version: -8<-- % make PYTHON_VERSION=3.6 clean check-plist <..> Configuring Javascript library... mkdir -p deps/mozilla/js/src/build-release <..> checking for python2.7... (cached) /usr/local/bin/python3.6 <..> checking for Python version >= 2.5... yes <..> ====> Compressing man pages (compress-man) ====> Running Q/A tests (stage-qa) ====> Checking for pkg-plist issues (check-plist) ===> Parsing plist ===> Checking for items in STAGEDIR missing from pkg-plist ===> Checking for items in pkg-plist which are not in STAGEDIR ===> No pkg-plist issues found (check-plist) -->8- > Please include an update to the MAINTAINER line if you can Thanks, but I interested in this PR only.
Created attachment 210814 [details] Proposed patch (since 520894 revision, Python 3.5+ variant) Added patch for Python 3.5+ variant, since Python 3.7 version is by default in Mk/bsd.default-versions.mk file. But lang/python27 port still exists, therefore committer may decide what to use.
Also note, that related dynamic patches and 2to3 usage was moved to pre-configure stage on purpose: - To support Python 2.7+ also (for first variant). - To not affect files/patch-deps_mozilla_js_src_configure patch, without a need to regenerate it (if `make patch` used), because this is a possible temporary case before Python 3 support from developers.
(In reply to lightside from comment #5) USES=python:<version> spec is declarative, not imperative, and should describe the Python versions a package 'supports', not which Python versions it should 'use', which is the responsibility of the ports framework and ultimately the user to select. If oolite supports Python 2.x/3.x, USES=python:<version-spec> should be 2.7+ or 2.7-3.x where x is the highest currently supported Python 3.x version
(In reply to Kubilay Kocak from comment #6) > If oolite supports Python 2.x/3.x, USES=python:<version-spec> should be 2.7+ > or 2.7-3.x where x is the highest currently supported Python 3.x version Yes, games/oolite build system supports Python 2.x. The dynamic patches and usage of 2to3 program before build stage allows to build with using Python 3.x. So, the first patch in attachment #210354 [details], which uses 2.7+ should be fine, while lang/python27 port is available (and not deprecated). I obsoleted attachment #210814 [details]. Thanks for clarification.
Can't we just make static patches (by importing future) instead of dynamically fiddling with the code? Also USES=python implies python 2.7 or higher, so no need to mention that explicitly.
Created attachment 211114 [details] Proposed patch (since 520894 revision) Hello, Rene Ladan. (In reply to Rene Ladan from comment #8) Ok, I proposed static patches, instead of using 2to3 and sed programs for this case. Thanks for attention.
Created attachment 211118 [details] Proposed patch (since 520894 revision, Python 3.5+ variant) Also possible to propose a patch, which uses Python 3.x only, since Python 3.7 version is by default in Mk/bsd.default-versions.mk file. It differs from attachment #210814 [details] by using static patches. Otherwise, on committer preference.
A commit references this bug: Author: rene Date: Mon Feb 3 13:45:50 UTC 2020 New revision: 525036 URL: https://svnweb.freebsd.org/changeset/ports/525036 Log: games/oolite: build with Python 3.5 or later, undeprecate PR: 242997 Submitted by: lightside Changes: head/games/oolite/Makefile head/games/oolite/files/patch-deps_mozilla_js_src_configure head/games/oolite/files/patch-deps_mozilla_js_src_configure.in head/games/oolite/files/patch-fixup-python
I've committed the 3.5 patch, thanks!