From nobody Wed Oct 19 09:36:40 2022 X-Original-To: questions@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4MslxK1cjNz4gQZ9; Wed, 19 Oct 2022 09:36:53 +0000 (UTC) (envelope-from contact@evilham.com) Received: from yggdrasil.evilham.com (yggdrasil.evilham.com [IPv6:2a02:2770::216:3eff:fee1:cf9]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4MslxJ04Ypz4Cnd; Wed, 19 Oct 2022 09:36:51 +0000 (UTC) (envelope-from contact@evilham.com) From: Evilham DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=evilham.com; s=mail; t=1666172204; bh=VDKvTa+Ib2pRXybIryr/7A0WwwA5DPGR5Ull+JrRNzc=; h=From:To:Cc:Subject:References:In-reply-to:Date; b=gbbPWQZe2XiexVLs/zr85kYdjsC610ZleMz6iBdkeaSDt4qkfEbUGVSQqDGhT0AAk wQgr/oscEWd5nAGjUkC0X+IBY6Rr6rLGOCt5qRz94Qjgo5YsUQmYKNXds+WZJ8jEJD MDk4g3IOd/kerclb8F1Y2B+SctmiZRGmEXkRmMcw= To: Tomek CEDRO Cc: FreeBSD Questions Mailing List , freebsd-hackers@freebsd.org, questions@freebsd.org Subject: Re: proper python3 interpreter invocation References: In-reply-to: Date: Wed, 19 Oct 2022 11:36:40 +0200 Message-ID: <33597a9aff9c418bdb4a7cd9364ebafe51d4@yggdrasil.evilham.com> List-Id: User questions List-Archive: https://lists.freebsd.org/archives/freebsd-questions List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-questions@freebsd.org X-BeenThere: freebsd-questions@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Rspamd-Queue-Id: 4MslxJ04Ypz4Cnd X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=evilham.com header.s=mail header.b=gbbPWQZe; dmarc=pass (policy=quarantine) header.from=evilham.com; spf=pass (mx1.freebsd.org: domain of contact@evilham.com designates 2a02:2770::216:3eff:fee1:cf9 as permitted sender) smtp.mailfrom=contact@evilham.com X-Spamd-Result: default: False [-4.00 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-0.999]; NEURAL_HAM_SHORT(-1.00)[-0.997]; DMARC_POLICY_ALLOW(-0.50)[evilham.com,quarantine]; R_SPF_ALLOW(-0.20)[+mx]; R_DKIM_ALLOW(-0.20)[evilham.com:s=mail]; MIME_GOOD(-0.10)[text/plain]; ARC_NA(0.00)[]; MLMMJ_DEST(0.00)[freebsd-hackers@freebsd.org,freebsd-questions@freebsd.org,questions@freebsd.org]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; DKIM_TRACE(0.00)[evilham.com:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; MID_RHS_MATCH_FROMTLD(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; ASN(0.00)[asn:196752, ipnet:2a02:2770::/32, country:NL] X-ThisMailContainsUnwantedMimeParts: N Hey, here just someone who has fiddled around with ports more than they are willing to admit, so take this with a grain of salt: On dc., oct. 19 2022, Tomek CEDRO wrote: > Hello world :-) > > Is Python 3 part of the base? Nope > > What would be the most valid way to invoke a Python 3 script? > > Two options are possible: > 1. #!/usr/bin/env python > 2. #!/usr/bin/env python3 There is no python port on FreeBSD, so 1 would usually fail. There *is* a python3 meta-port which points to the currently blessed python3 version. > > I am working on a mobile application in Python + Kivy that can > be then > converted into Android and iOS application. It works fine here > on > FreeBSD even in bare console (DRM KMS). I would like to build > Android > application on FreeBSD (I know iOS version needs macOS+XCode). > For > that I need Android NDK that is officially only provided for > Windows, > macOS and Linux. I did a modification to make it work on FreeBSD > using > Linux binaries. The goal is to create a FreeBSD Port for Android > NDK > (no official support / releases will be provided for our > platform). > But the patches are rejected at the upstream :-( > > https://github.com/android/ndk/issues/1780 > https://github.com/android/ndk/issues/1781 > https://github.com/android/ndk/issues/1785 That's great, that you're working on it that is. For this kind of project, sadly I think it is somewhat common that upstream is a tad.. reticent accepting such patches. Possibly the rationale is that if you get this to work, they'll start getting support requests / bug reports that have "nothing to do with their project". Who knows. > > This one is interesting in particular: > https://github.com/android/ndk/issues/1785 > > Some of their scripts use `#!/usr/bin/env python3` and some use > `#!/usr/bin/env python`. The ones using `python` does not work > out of > the box on FreeBSD.. so I wanted to unify the interpreter to use > `python3` (or `python` whatever is best if there was any kind of > sensible discussion). > > I know that I can create a Python VirtualEnv where python == > python3. > Also I can create a symlink /usr/local/bin/python3 -> > /usr/local/bin/python but that customization will make system > incoherent with other standard installations. Maybe I should > simply > create local patches when creating that port? There is something even better than local patches, which is a shebangfix! It'll point to the exact python version that is being supported (aka python3.X nowadays): This is something actually supported by the ports infrastructure. https://docs.freebsd.org/en/books/porters-handbook/uses/#uses-shebangfix You can use it to, ehem, fix the shebang :-). Off memory I can't recall a python port using that, but I am confident you'll find it by grepping around the ports tree. Good luck moving forward ^^. -- Evilham > Google not only does not and will not provide releases for > FreeBSD but > also rejects patches to make things work here. We are doomed to > a > local fork on purpose :-( > > What would be the proper approach on FreeBSD? Where am I wrong? > > Any hints welcome :-) > Tomek