From fedfe65eb887bb91d049586ecb3b76dd9539e01c Mon Sep 17 00:00:00 2001 From: Bo Anderson Date: Mon, 22 Mar 2021 17:34:20 +0000 Subject: [PATCH] python-tk@3.9 3.9.2 (new formula) --- Aliases/python-tk | 1 + Formula/python-tk@3.9.rb | 43 +++++++++++++++++++ .../versioned_keg_only_allowlist.json | 3 +- 3 files changed, 46 insertions(+), 1 deletion(-) create mode 120000 Aliases/python-tk create mode 100644 Formula/python-tk@3.9.rb diff --git a/Aliases/python-tk b/Aliases/python-tk new file mode 120000 index 00000000000..7390342d99d --- /dev/null +++ b/Aliases/python-tk @@ -0,0 +1 @@ +../Formula/python-tk@3.9.rb \ No newline at end of file diff --git a/Formula/python-tk@3.9.rb b/Formula/python-tk@3.9.rb new file mode 100644 index 00000000000..cd55fb18015 --- /dev/null +++ b/Formula/python-tk@3.9.rb @@ -0,0 +1,43 @@ +class PythonTkAT39 < Formula + desc "Python interface to Tcl/Tk" + homepage "https://www.python.org/" + # Keep in sync with python@3.9. + url "https://www.python.org/ftp/python/3.9.2/Python-3.9.2.tar.xz" + sha256 "3c2034c54f811448f516668dce09d24008a0716c3a794dd8639b5388cbde247d" + license "Python-2.0" + + livecheck do + url "https://www.python.org/ftp/python/" + regex(%r{href=.*?v?(3\.9(?:\.\d+)*)/?["' >]}i) + end + + depends_on "python@3.9" + depends_on "tcl-tk" + + def install + cd "Modules" do + tcltk_version = Formula["tcl-tk"].any_installed_version.major_minor + (Pathname.pwd/"setup.py").write <<~EOS + from setuptools import setup, Extension + + setup(name="tkinter", + description="#{desc}", + version="#{version}", + ext_modules = [ + Extension("_tkinter", ["_tkinter.c", "tkappinit.c"], + define_macros=[("WITH_APPINIT", 1)], + include_dirs=["#{Formula["tcl-tk"].opt_include}"], + libraries=["tcl#{tcltk_version}", "tk#{tcltk_version}"], + library_dirs=["#{Formula["tcl-tk"].opt_lib}"]) + ] + ) + EOS + system Formula["python@3.9"].bin/"python3", *Language::Python.setup_install_args(prefix) + rm_r Dir[lib/"python3.9/site-packages/*.egg-info"] + end + end + + test do + system Formula["python@3.9"].bin/"python3", "-c", "import tkinter; root = tkinter.Tk()" + end +end diff --git a/audit_exceptions/versioned_keg_only_allowlist.json b/audit_exceptions/versioned_keg_only_allowlist.json index d8d928305ae..1a002d2ce9c 100644 --- a/audit_exceptions/versioned_keg_only_allowlist.json +++ b/audit_exceptions/versioned_keg_only_allowlist.json @@ -20,5 +20,6 @@ "openssl@1.1", "pangomm@2.46", "pyqt@5", - "python@3.9" + "python@3.9", + "python-tk@3.9" ]