Skip to content

Commit

Permalink
Add script to vendor tomli in flit_core
Browse files Browse the repository at this point in the history
  • Loading branch information
takluyver committed Dec 22, 2021
1 parent 3eb2130 commit dad3ab9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
Empty file.
18 changes: 18 additions & 0 deletions flit_core/update-vendored-tomli.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,18 @@
#!/bin/bash
# Update the vendored copy of tomli
set -euo pipefail

version=$1
echo "Bundling tomli version $version"

rm -rf flit_core/vendor/tomli*
pip install --target flit_core/vendor/ "tomli==$version"

# Convert absolute imports to relative (from tomli.foo -> from .foo)
for file in flit_core/vendor/tomli/*.py; do
sed -i -E 's/((from|import)[[:space:]] )tomli\./\1\./' "$file"
done

# Delete some files that aren't useful in this context.
# Leave LICENSE & METADATA present.
rm flit_core/vendor/tomli*.dist-info/{INSTALLER,RECORD,REQUESTED,WHEEL}

0 comments on commit dad3ab9

Please sign in to comment.