Skip to content

Commit

Permalink
add: cosmopolitan build (closes #31)
Browse files Browse the repository at this point in the history
  • Loading branch information
metaist committed Aug 21, 2024
1 parent 705980a commit 1ae0653
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
3 changes: 3 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ ds all
# check build
ds build

# build binary
ds cosmo

# commit and push tags
ds release: $VER
```
Expand Down
26 changes: 20 additions & 6 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,26 @@ dev = ["lint", "test"]
all = ["lint", "test", "cog", "docs"]

build = ["pip install -e .", "python -m build"]
clean = """
rm -rf .mypy_cache;
rm -rf .pytest_cache;
rm -rf .ruff_cache;
rm -rf dist;
rm -rf .coverage;

cosmo.help = "Build cosmopolitan portable executable."
cosmo.shell = """
PKG="ds";
DIR="dist/cosmo";
DIR_PKG="Lib/site-packages/$PKG"
mkdir -p "$DIR/$DIR_PKG";
cp src/$PKG/*.py "$DIR/$DIR_PKG";
pushd $DIR;
printf -- "-m\\n$PKG\\n..." > .args;
wget -N https://cosmo.zip/pub/cosmos/bin/python;
chmod +x python;
./python -m compileall -b $DIR_PKG;
rm $DIR_PKG/*.py;
cp python $PKG.zip;
zip -r $PKG.zip .args Lib;
zip -d $PKG.zip Lib/site-packages/pip;
zip -d $PKG.zip 'usr/*';
mv $PKG.zip $PKG
popd
"""

release = """
Expand Down

0 comments on commit 1ae0653

Please sign in to comment.