mirror of https://github.com/KLayout/klayout.git
Merge pull request #1394 from KLayout/issue_1390_v2
make_stubs now automatically detects installed klayout in python environment
This commit is contained in:
commit
9fa0bc5ebb
|
|
@ -74,15 +74,12 @@ jobs:
|
||||||
with:
|
with:
|
||||||
path: ./wheelhouse/*.whl
|
path: ./wheelhouse/*.whl
|
||||||
|
|
||||||
# The following was taken from https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/
|
# The following was taken from https://cibuildwheel.readthedocs.io/en/stable/deliver-to-pypi/
|
||||||
make_sdist:
|
make_sdist:
|
||||||
name: Make SDist
|
name: Make SDist
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
with:
|
|
||||||
fetch-depth: 0 # Optional, use if you use setuptools_scm
|
|
||||||
submodules: true # Optional, use if you have submodules
|
|
||||||
|
|
||||||
- name: Build SDist
|
- name: Build SDist
|
||||||
run: pipx run build --sdist
|
run: pipx run build --sdist
|
||||||
|
|
@ -105,7 +102,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
user: __token__
|
user: __token__
|
||||||
password: ${{ secrets.test_pypi_password }}
|
password: ${{ secrets.test_pypi_password }}
|
||||||
repository_url: https://test.pypi.org/legacy/
|
repository-url: https://test.pypi.org/legacy/
|
||||||
|
|
||||||
upload_to_pypi:
|
upload_to_pypi:
|
||||||
needs: [build, make_sdist]
|
needs: [build, make_sdist]
|
||||||
|
|
|
||||||
|
|
@ -1,29 +1,40 @@
|
||||||
#!/bin/bash -e
|
#!/bin/bash -e
|
||||||
|
|
||||||
# Generates LVS and DRC documentation
|
# Generates pyi stubs
|
||||||
#
|
#
|
||||||
# Run this script from a valid build below the repository root, e.g.
|
# Run this script from a valid build below the repository root, e.g.
|
||||||
# <repo-root>/build-debug. It needs to have a "pymod" installation in
|
# <repo-root>/build-debug. It needs to have a "pymod" installation in
|
||||||
# current directory.
|
# current directory.
|
||||||
|
|
||||||
inst=$(realpath $(dirname $0))
|
inst=$(realpath $(dirname $0))
|
||||||
scripts=${inst}/drc_lvs_doc
|
|
||||||
ld=$(realpath .)
|
|
||||||
|
|
||||||
pymod="$ld/pymod"
|
## Detect if klayout pymod libraries are installed
|
||||||
|
python=
|
||||||
|
for try_python in python python3; do
|
||||||
|
if $try_python -c "import klayout.tl" >/dev/null 2>&1; then
|
||||||
|
python=$try_python
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=$ld
|
if [ "$python" = "" ]; then
|
||||||
export PYTHONPATH=$pymod
|
echo "*** Searching for pymod..."
|
||||||
|
|
||||||
pymod_src=$ld/../src/pymod
|
ld=$(realpath .)
|
||||||
if ! [ -e $pymod_src ]; then
|
pymod="$ld/pymod"
|
||||||
|
|
||||||
|
export LD_LIBRARY_PATH=$ld
|
||||||
|
export PYTHONPATH=$pymod
|
||||||
|
|
||||||
|
pymod_src=$ld/../src/pymod
|
||||||
|
if ! [ -e $pymod_src ]; then
|
||||||
echo "*** ERROR: missing pymod sources ($pymod_src) - did you run the script from the build folder below the source tree?"
|
echo "*** ERROR: missing pymod sources ($pymod_src) - did you run the script from the build folder below the source tree?"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! [ -e $pymod ]; then
|
if ! [ -e $pymod ]; then
|
||||||
echo "*** ERROR: missing pymod folder ($pymod) - did you run the script from the build folder?"
|
echo "*** ERROR: missing pymod folder ($pymod) - did you run the script from the build folder?"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
python=
|
python=
|
||||||
|
|
@ -38,20 +49,21 @@ if [ "$python" = "" ]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pyi_srcdir="$inst/../src/pymod/distutils_src/klayout"
|
||||||
|
|
||||||
echo "Generating stubs for tl .."
|
echo "Generating stubs for tl .."
|
||||||
$python $inst/stubgen.py tl >$pymod_src/distutils_src/klayout/tlcore.pyi
|
$python $inst/stubgen.py tl >$pyi_srcdir/tlcore.pyi
|
||||||
|
|
||||||
echo "Generating stubs for db .."
|
echo "Generating stubs for db .."
|
||||||
$python $inst/stubgen.py db tl >$pymod_src/distutils_src/klayout/dbcore.pyi
|
$python $inst/stubgen.py db tl >$pyi_srcdir/dbcore.pyi
|
||||||
|
|
||||||
echo "Generating stubs for rdb .."
|
echo "Generating stubs for rdb .."
|
||||||
$python $inst/stubgen.py rdb tl,db >$pymod_src/distutils_src/klayout/rdbcore.pyi
|
$python $inst/stubgen.py rdb tl,db >$pyi_srcdir/rdbcore.pyi
|
||||||
|
|
||||||
echo "Generating stubs for lay .."
|
echo "Generating stubs for lay .."
|
||||||
$python $inst/stubgen.py lay tl,db,rdb >$pymod_src/distutils_src/klayout/laycore.pyi
|
$python $inst/stubgen.py lay tl,db,rdb >$pyi_srcdir/laycore.pyi
|
||||||
|
|
||||||
echo "Generating stubs for lib .."
|
echo "Generating stubs for lib .."
|
||||||
$python $inst/stubgen.py lib tl,db >$pymod_src/distutils_src/klayout/libcore.pyi
|
$python $inst/stubgen.py lib tl,db >$pyi_srcdir/libcore.pyi
|
||||||
|
|
||||||
echo "Done."
|
echo "Done."
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue