# Maintainer: Ɓukasz Jendrysik # Contributor: Kiyoshi Aman global pkgname := 'python3' global pkgver := '3.6.3' global _basever := $(pkgver%.*) global pkgrel := '3' global pkgdesc := '"A high-level scripting language'" global url := '"http://www.python.org'" global arch := '"all'" global license := '"custom'" global provides := '"py3-pip'" global subpackages := ""$pkgname-dev $pkgname-doc $pkgname-tests::noarch $pkgname-tkinter:tkinter $pkgname-wininst"" global makedepends := '"expat-dev libressl-dev zlib-dev ncurses-dev bzip2-dev xz-dev sqlite-dev libffi-dev tcl-dev linux-headers gdbm-dev readline-dev tk tk-dev'" global source := ""http://www.python.org/ftp/python/$pkgver/Python-$pkgver.tar.xz musl-find_library.patch fix-xattrs-glibc.patch bpo-30353.patch "" global builddir := ""$srcdir/Python-$pkgver"" proc prepare { default_prepare cd $builddir # force system libs rm -r Modules/expat \ Modules/zlib \ Modules/_ctypes/darwin* \ Modules/_ctypes/libffi* } proc build { cd $builddir # --enable-optimizations is not enabled because it # is very, very slow as many tests are ran sequentially # for profile guided optimizations. additionally it # seems some of the training tests hang on certain # e.g. architectures (x86) possibly due to grsec or musl. ./configure \ --prefix=/usr \ --disable-rpath \ --enable-ipv6 \ --enable-loadable-sqlite-extensions \ --enable-shared \ --with-lto \ --with-computed-gotos \ --with-dbmliborder=gdbm:ndbm \ --with-system-expat \ --with-system-ffi \ --with-threads make EXTRA_CFLAGS="$CFLAGS" } proc check { cd $builddir var fail = '' # musl related fail := '"test__locale test_locale test_strptime test_re'" # various musl locale deficiencies fail := ""$fail test_datetime"" # hangs if 'tzdata' installed fail := ""$fail test_os"" # fpathconf, ttyname errno values fail := ""$fail test_posix"" # sched_[gs]etscheduler not impl fail := ""$fail test_shutil"" # lchmod, requires real unzip # failures needing investigation fail := ""$fail test_faulthandler test_gdb"" # hangs(?) fail := ""$fail test_tokenize test_tools"" # SLOW (~60s) fail := ""$fail test_capi"" # test.test_capi.EmbeddingTests fail := ""$fail test_threadsignals"" # test_{,r}lock_acquire_interruption fail := ""$fail test_time"" # strftime/strptime %Z related fail := ""$fail test_cmath test_math"" # hang(?) on x86 fail := ""$fail test_hash test_plistlib"" # fail on armhf fail := ""$fail test_ctypes"" # fail on aarch64 (ctypes.test.test_win32.Structures) # kernel related fail := ""$fail test_fcntl"" # wants DNOTIFY, we don't have it make quicktest TESTOPTS="--exclude $fail" } proc package { cd $builddir make -j1 DESTDIR="$pkgdir" EXTRA_CFLAGS="$CFLAGS" install maninstall install -Dm644 LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE } proc dev { default_dev # pyconfig.h is needed runtime so we move it back mkdir -p "$pkgdir"/usr/include/python$(_basever)m mv "$subpkgdir"/usr/include/python$(_basever)m/pyconfig.h \ "$pkgdir"/usr/include/python$(_basever)m/ } proc tests { global pkgdesc := '"The test modules from the main python package'" cd "$pkgdir"/usr/lib/python$_basever var i = ''; for i in [*/test */tests] { mkdir -p "$subpkgdir"/usr/lib/python$_basever/"$i" mv "$i"/* "$subpkgdir"/usr/lib/python$_basever/"$i" rm -rf $i } mv "$pkgdir"/usr/lib/python$_basever/test \ "$subpkgdir"/usr/lib/python$_basever/ } proc tkinter { global pkgdesc := '"A graphical user interface for the Python'" var libdir = ""usr/lib/python$_basever/lib-dynload"" mkdir -p "$subpkgdir"/$libdir mv "$pkgdir"/$libdir/_tkinter.*.so "$subpkgdir"/$libdir/ } proc wininst { global pkgdesc := '"Python wininst files'" mkdir -p "$subpkgdir"/usr/lib/python$_basever/distutils/command mv "$pkgdir"/usr/lib/python$_basever/distutils/command/*.exe \ "$subpkgdir"/usr/lib/python$_basever/distutils/command } global sha512sums := '"32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b Python-3.6.3.tar.xz ab8eaa2858d5109049b1f9f553198d40e0ef8d78211ad6455f7b491af525bffb16738fed60fc84e960c4889568d25753b9e4a1494834fea48291b33f07000ec2 musl-find_library.patch 37b6ee5d0d5de43799316aa111423ba5a666c17dc7f81b04c330f59c1d1565540eac4c585abe2199bbed52ebe7426001edb1c53bd0a17486a2a8e052d0f494ad fix-xattrs-glibc.patch df54032e66171483aad24f9f370e185072dcb2d6981210a8dd79b5fa51c2c7aa64da2501aa96bb5009bfb658387851068bc82f23c515f739672722495c2c98dd bpo-30353.patch'" (CommandList children: [ (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgname) op:Equal rhs:{(python3)} spids:[7])] spids: [7] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgver) op:Equal rhs:{(3.6.3)} spids:[10])] spids: [10] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:_basever) op: Equal rhs: { (DQ (BracedVarSub token: suffix_op: (StringUnary op_id:VOp1_Percent arg_word:{(".*")}) spids: [15 19] ) ) } spids: [13] ) ] spids: [13] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:pkgrel) op:Equal rhs:{(3)} spids:[22])] spids: [22] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("A high-level scripting language"))} spids: [25] ) ] spids: [25] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:url) op: Equal rhs: {(DQ ("http://www.python.org"))} spids: [30] ) ] spids: [30] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:arch) op:Equal rhs:{(DQ (all))} spids:[35])] spids: [35] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:license) op:Equal rhs:{(DQ (custom))} spids:[40])] spids: [40] ) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:provides) op:Equal rhs:{(DQ (py3-pip))} spids:[45])] spids: [45] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:subpackages) op: Equal rhs: { (DQ ($ VSub_Name "$pkgname") ("-dev ") ($ VSub_Name "$pkgname") ("-doc ") ($ VSub_Name "$pkgname") ("-tests::noarch\n") ("\t") ($ VSub_Name "$pkgname") ("-tkinter:tkinter ") ($ VSub_Name "$pkgname") (-wininst) ) } spids: [50] ) ] spids: [50] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:makedepends) op: Equal rhs: { (DQ ("expat-dev libressl-dev zlib-dev ncurses-dev bzip2-dev xz-dev\n") ("\tsqlite-dev libffi-dev tcl-dev linux-headers gdbm-dev readline-dev\n") ("\ttk tk-dev") ) } spids: [65] ) ] spids: [65] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:source) op: Equal rhs: { (DQ ("http://www.python.org/ftp/python/") ($ VSub_Name "$pkgver") (/Python-) ($ VSub_Name "$pkgver") (".tar.xz\n") ("\tmusl-find_library.patch\n") ("\tfix-xattrs-glibc.patch\n") ("\tbpo-30353.patch\n") ("\t") ) } spids: [72] ) ] spids: [72] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:builddir) op: Equal rhs: {(DQ ($ VSub_Name "$srcdir") (/Python-) ($ VSub_Name "$pkgver"))} spids: [85] ) ] spids: [85] ) (FuncDef name: prepare body: (BraceGroup children: [ (C {(default_prepare)}) (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(rm)} {(-r)} {(Modules/expat)} {(Modules/zlib)} {(Modules/_ctypes/darwin) (Lit_Other "*")} {(Modules/_ctypes/libffi) (Lit_Other "*")} ) ] spids: [97] ) spids: [93 96] ) (FuncDef name: build body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(./configure)} {(--prefix) (Lit_Other "=") (/usr)} {(--disable-rpath)} {(--enable-ipv6)} {(--enable-loadable-sqlite-extensions)} {(--enable-shared)} {(--with-lto)} {(--with-computed-gotos)} {(--with-dbmliborder) (Lit_Other "=") (gdbm) (Lit_Other ":") (ndbm)} {(--with-system-expat)} {(--with-system-ffi)} {(--with-threads)} ) (C {(make)} {(Lit_VarLike "EXTRA_CFLAGS=") (DQ ($ VSub_Name "$CFLAGS"))}) ] spids: [142] ) spids: [138 141] ) (FuncDef name: check body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:fail) op:Equal spids:[254])] spids: [252] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ("test__locale test_locale test_strptime test_re"))} spids: [262] ) ] spids: [262] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_datetime"))} spids: [271] ) ] spids: [271] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_os"))} spids: [281] ) ] spids: [281] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_posix"))} spids: [291] ) ] spids: [291] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_shutil"))} spids: [301] ) ] spids: [301] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_faulthandler test_gdb"))} spids: [316] ) ] spids: [316] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_tokenize test_tools"))} spids: [326] ) ] spids: [326] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_capi"))} spids: [336] ) ] spids: [336] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_threadsignals"))} spids: [346] ) ] spids: [346] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_time"))} spids: [356] ) ] spids: [356] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_cmath test_math"))} spids: [366] ) ] spids: [366] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_hash test_plistlib"))} spids: [376] ) ] spids: [376] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_ctypes"))} spids: [386] ) ] spids: [386] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:fail) op: Equal rhs: {(DQ ($ VSub_Name "$fail") (" test_fcntl"))} spids: [401] ) ] spids: [401] ) (C {(make)} {(quicktest)} {(Lit_VarLike "TESTOPTS=") (DQ ("--exclude ") ($ VSub_Name "$fail"))} ) ] spids: [242] ) spids: [238 241] ) (FuncDef name: package body: (BraceGroup children: [ (C {(cd)} {(DQ ($ VSub_Name "$builddir"))}) (C {(make)} {(-j1)} {(Lit_VarLike "DESTDIR=") (DQ ($ VSub_Name "$pkgdir"))} {(Lit_VarLike "EXTRA_CFLAGS=") (DQ ($ VSub_Name "$CFLAGS"))} {(install)} {(maninstall)} ) (C {(install)} {(-Dm644)} {(LICENSE)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/share/licenses/) ($ VSub_Name "$pkgname") (/LICENSE)} ) ] spids: [429] ) spids: [425 428] ) (FuncDef name: dev body: (BraceGroup children: [ (C {(default_dev)}) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/include/python) (${ VSub_Name _basever) (m)} ) (C {(mv)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/include/python) (${ VSub_Name _basever) (m/pyconfig.h) } {(DQ ($ VSub_Name "$pkgdir")) (/usr/include/python) (${ VSub_Name _basever) (m/)} ) ] spids: [478] ) spids: [474 477] ) (FuncDef name: tests body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("The test modules from the main python package"))} spids: [535] ) ] spids: [535] ) (C {(cd)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever")}) (Sentence child: (Assignment keyword: Assign_Local pairs: [(assign_pair lhs:(LhsName name:i) op:Equal spids:[553])] spids: [551] ) terminator: ) (ForEach iter_name: i iter_words: [{(Lit_Other "*") (/test)} {(Lit_Other "*") (/tests)}] do_arg_iter: False body: (DoGroup children: [ (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/) (DQ ($ VSub_Name "$i")) } ) (C {(mv)} {(DQ ($ VSub_Name "$i")) (/) (Lit_Other "*")} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/) (DQ ($ VSub_Name "$i")) } ) (C {(rm)} {(-rf)} {(DQ ($ VSub_Name "$i"))}) ] spids: [569 615] ) spids: [561 567] ) (C {(mv)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/test)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/)} ) ] spids: [532] ) spids: [528 531] ) (FuncDef name: tkinter body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("A graphical user interface for the Python"))} spids: [646] ) ] spids: [646] ) (Assignment keyword: Assign_Local pairs: [ (assign_pair lhs: (LhsName name:libdir) op: Equal rhs: {(DQ (usr/lib/python) ($ VSub_Name "$_basever") (/lib-dynload))} spids: [654] ) ] spids: [652] ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$subpkgdir")) (/) ($ VSub_Name "$libdir")}) (C {(mv)} {(DQ ($ VSub_Name "$pkgdir")) (/) ($ VSub_Name "$libdir") (/_tkinter.) (Lit_Other "*") (.so) } {(DQ ($ VSub_Name "$subpkgdir")) (/) ($ VSub_Name "$libdir") (/)} ) ] spids: [643] ) spids: [639 642] ) (FuncDef name: wininst body: (BraceGroup children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:pkgdesc) op: Equal rhs: {(DQ ("Python wininst files"))} spids: [702] ) ] spids: [702] ) (C {(mkdir)} {(-p)} {(DQ ($ VSub_Name "$subpkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/distutils/command) } ) (C {(mv)} {(DQ ($ VSub_Name "$pkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/distutils/command/) (Lit_Other "*") (.exe) } {(DQ ($ VSub_Name "$subpkgdir")) (/usr/lib/python) ($ VSub_Name "$_basever") (/distutils/command)} ) ] spids: [699] ) spids: [695 698] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:sha512sums) op: Equal rhs: { (DQ ( "32f24a3adcb7880003c7ecdc5e53e838e774adda76b308961d8215e28db630b2fa2828097817924c76afa4212b2df3362eb64d4e10f37c0147f512ec5aa8662b Python-3.6.3.tar.xz\n" ) ( "ab8eaa2858d5109049b1f9f553198d40e0ef8d78211ad6455f7b491af525bffb16738fed60fc84e960c4889568d25753b9e4a1494834fea48291b33f07000ec2 musl-find_library.patch\n" ) ( "37b6ee5d0d5de43799316aa111423ba5a666c17dc7f81b04c330f59c1d1565540eac4c585abe2199bbed52ebe7426001edb1c53bd0a17486a2a8e052d0f494ad fix-xattrs-glibc.patch\n" ) ( "df54032e66171483aad24f9f370e185072dcb2d6981210a8dd79b5fa51c2c7aa64da2501aa96bb5009bfb658387851068bc82f23c515f739672722495c2c98dd bpo-30353.patch" ) ) } spids: [743] ) ] spids: [743] ) ] )