python-tk@3.9 3.9.2 (new formula)

master
Bo Anderson 2021-03-22 17:34:20 +00:00
parent 80412c2807
commit fedfe65eb8
3 changed files with 46 additions and 1 deletions

1
Aliases/python-tk Symbolic link
View File

@ -0,0 +1 @@
../Formula/python-tk@3.9.rb

43
Formula/python-tk@3.9.rb Normal file
View File

@ -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

View File

@ -20,5 +20,6 @@
"openssl@1.1",
"pangomm@2.46",
"pyqt@5",
"python@3.9"
"python@3.9",
"python-tk@3.9"
]