Python rec’d deps (#75)

This commit is contained in:
Max Howell 2022-08-04 21:19:01 -04:00 committed by GitHub
parent 297c576b54
commit 6cef318164
6 changed files with 175 additions and 2 deletions

View file

@ -78,9 +78,13 @@ jobs:
TEA_SECRET: ${{ secrets.TEA_SECRET }}
if: ${{ matrix.os == 'macos-11' }}
- name: topological sort
id: sorted
run: ./scripts/sort.ts ${{ needs.get-diff.outputs.diff }}
- name: Build
run: |
./scripts/build.ts ${{ needs.get-diff.outputs.diff }}
./scripts/build.ts ${{ steps.sorted.outputs.pkgs }}
id: build
env:
GITHUB_TOKEN: ${{ github.token }}

View file

@ -0,0 +1,21 @@
distributable:
url: https://ftp.gnu.org/gnu/readline/readline-{{ version.raw }}.tar.gz
strip-components: 1
versions:
#TODO brew has a couple patches we should apply
- 8.1
dependencies:
invisible-island.net/ncurses: 6
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
script: |
./configure --prefix={{ prefix }} --with-curses
make --jobs {{ hw.concurrency }} install
test:
script: true #FIXME

View file

@ -0,0 +1,31 @@
distributable:
url: https://ftp.gnu.org/gnu/ncurses/ncurses-{{ version.raw }}.tar.gz
strip-components: 1
versions:
github: mirror/ncurses/tags
build:
dependencies:
freedesktop.org/pkg-config: ^0.29
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
script: |
mkdir -p $PCDIR
./configure $ARGS
make --jobs {{ hw.concurrency }} install
env:
PCDIR: ${{prefix}}/lib/pkgconfig
ARGS:
- --prefix={{ prefix }}
- --enable-pc-files
- --enable-sigwinch
- --enable-widec
- --with-shared
- --with-cxx-shared
- --with-gpm=no
- --without-ada
- --with-pkg-config-libdir=$PCDIR
test:
script: true #FIXME

View file

@ -6,12 +6,25 @@ versions:
github: python/cpython/tags
dependencies:
# recommended but none are actually required
zlib.net: 1
sourceware.org/bzip2: 1
openssl.org: ^1.1
sourceware.org/libffi: 3
libexpat.github.io: 2
bytereef.org/mpdecimal: 2
tukaani.org/xz: 5
sqlite.org: 3
gnu.org/readline: 8
invisible-island.net/ncurses: 6
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
freedesktop.org/pkg-config: ^0.29
#TODO use the diff
script: |
sed -i.bak -e 's|system_lib_dirs = .*|system_lib_dirs = os.getenv("LIBRARY_PATH").split(":")|' ./setup.py
sed -i.bak -e 's|system_include_dirs = .*|system_include_dirs = os.getenv("CPATH").split(":")|' ./setup.py
@ -20,7 +33,7 @@ build:
make --jobs {{ hw.concurrency }}
make install
cd {{ prefix }}/bin
ln -s python{{ version.major }} python
ln -sf python{{ version.major }} python
env:
SHARE: /opt/python.org/share
@ -43,6 +56,22 @@ build:
# put data that doesnt vary between pythons in a consistent place
- --datarootdir="$SHARE"
- --datadir="$SHARE"
diff: |
diff --git a/setup.py b/setup.py
index 85a2b26..4f2f742 100644
--- a/setup.py
+++ b/setup.py
@@ -847,8 +847,8 @@ class PyBuildExt(build_ext):
add_dir_to_list(self.compiler.include_dirs,
sysconfig.get_config_var("INCLUDEDIR"))
- system_lib_dirs = ['/lib64', '/usr/lib64', '/lib', '/usr/lib']
- system_include_dirs = ['/usr/include']
+ system_lib_dirs = os.getenv("LIBRARY_PATH").split(":")
+ system_include_dirs = os.getenv("CPATH").split(":")
# lib_dirs and inc_dirs are used to search for files;
# if a file is found in one of those directories, it can
# be assumed that no additional -I,-L directives are needed.
test:
#TODO test all modules eg zlib module

View file

@ -0,0 +1,39 @@
distributable:
#TODO lol supporting this URL scheme will be fun
url: https://sqlite.org/2022/sqlite-autoconf-3390200.tar.gz
strip-components: 1
versions:
github: sqlite/sqlite/tags
strip: /^version-/
dependencies:
zlib.net: 1
gnu.org/readline: 8
build:
dependencies:
tea.xyz/gx/cc: c99
tea.xyz/gx/make: '*'
script: |
./configure $ARGS
make --jobs {{ hw.concurrency }} install
env:
ARGS:
- --prefix={{ prefix }}
- --enable-dynamic-extensions
- --enable-readline
- --disable-editline
- --enable-session
CPPFLAGS:
# copied without explanation from brew
- -DSQLITE_ENABLE_COLUMN_METADATA=1
- -DSQLITE_ENABLE_RTREE=1
- -DSQLITE_ENABLE_FTS3=1 -DSQLITE_ENABLE_FTS3_PARENTHESIS=1
- -DSQLITE_ENABLE_JSON1=1
# Default value of MAX_VARIABLE_NUMBER is 999 which is too low for many
# applications. Set to 250000 (Same value used in Debian and Ubuntu).
- -DSQLITE_MAX_VARIABLE_NUMBER=250000
test:
script: sqlite3 --version

49
scripts/sort.ts Executable file
View file

@ -0,0 +1,49 @@
#!/usr/bin/env -S tea -E
/*---
args:
- deno
- run
- --allow-net
- --allow-run
- --allow-read=/opt,/Library/Developer/CommandLineTools
- --allow-write=/opt
- --allow-env
- --import-map={{ srcroot }}/import-map.json
---*/
import { parsePackageRequirement } from "types"
import usePantry from "hooks/usePantry.ts"
import hydrate from "prefab/hydrate.ts"
const dry = Deno.args.map(project => {
const match = project.match(/projects\/(.*)\/package.yml/)
return match ? match[1] : project
}).map(parsePackageRequirement)
const cum: string[] = []
const set = new Set(dry.map(x => x.project))
const pantry = usePantry()
for (const pkg of dry) {
const deps = await pantry.getDeps(pkg)
const wet = await hydrate([...deps.runtime, ...deps.build])
for (const {project: dep} of wet) {
if (set.has(dep)) {
cum.push(dep)
}
}
cum.push(pkg.project)
}
const rv = new Array<string>()
const newset = new Set()
for (const pkg of cum) {
if (!newset.has(pkg)) {
rv.push(pkg)
newset.add(pkg)
}
}
console.log(`::set-output name=pkgs::${rv.join(" ")}`)