Skip to content

Commit

Permalink
Fix pip release, c2cwsgiutils-run in the Python egg
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrunner committed Jul 8, 2020
1 parent ebf7840 commit 5de6f82
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ jobs:
runs-on: ubuntu-18.04
timeout-minutes: 15

env:
PATH: /bin:/usr/bin:/usr/local/bin:/home/runner/.local/bin

steps:
- uses: actions/checkout@v1

Expand All @@ -32,5 +35,12 @@ jobs:
- name: Install GDAL
run: docker run --rm camptocamp/c2cwsgiutils install-gdal

- name: Check python package
run: |
sudo apt install --yes python3-setuptools python3-wheel
python3 -m pip install --requirement=requirements-publish.txt
python3 ./setup.py bdist_wheel
twine check dist/*
- name: Release
run: scripts/publish ${{github.ref}}
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ FROM base-all AS base

CMD ["c2cwsgiutils-run"]

COPY scripts/c2cwsgiutils-run scripts/install-gdal /usr/bin/
COPY scripts/install-gdal /usr/bin/
COPY scripts/c2cwsgiutils-run /opt/c2cwsgiutils/scripts/
COPY setup.py setup.cfg /opt/c2cwsgiutils/
COPY c2cwsgiutils /opt/c2cwsgiutils/c2cwsgiutils
RUN python3 -m pip install --disable-pip-version-check --no-cache-dir --no-deps \
Expand Down
4 changes: 3 additions & 1 deletion requirements-publish.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
pipfile==0.0.2
twine==3.1.1
setuptools==47.1.0
keyrings.alt==3.4.0
setuptools==49.1.0
wheel==0.34.2
4 changes: 2 additions & 2 deletions scripts/publish
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash -e
#!/bin/bash -eux

if [[ $1 =~ ^refs/tags/([0-9]+(\.[0-9]+)*)$ ]]
then
Expand All @@ -7,7 +7,7 @@ then
summon --yaml '
USERNAME: !var gs/ci/pypi/username
PASSWORD: !var gs/ci/pypi/password
' bash -c 'scripts/release "${tag}"'
' bash -c "scripts/release '${tag}'"
echo "Release tag ${tag}"
elif [[ $1 =~ ^refs/heads/(release_[0-9]+)$ ]]
then
Expand Down
9 changes: 3 additions & 6 deletions scripts/release
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/bin/bash -e
#!/bin/bash -eux

VERSION=$1

actual_version=$(python3 ./setup.py --version 2> /dev/null)
actual_version=$(python3 ./setup.py --version)

if [[ "${VERSION}" != "${actual_version}" ]]
then
Expand All @@ -16,10 +16,7 @@ then
exit 0
fi

python3 -m pip install --requirement=requirements-publish.txt

python3 ./setup.py bdist_wheel

set +x
if twine upload -u "${USERNAME}" -p "${PASSWORD}" dist/*.whl
then
echo "Upload to pypi successful"
Expand Down
6 changes: 4 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
HERE = os.path.abspath(os.path.dirname(__file__))


def long_description():
def long_description() -> str:
try:
return open("README.md").read()
with open("README.md") as f:
return f.read()
except FileNotFoundError:
return ""

Expand Down Expand Up @@ -59,4 +60,5 @@ def long_description():
"c2c+egg=c2cwsgiutils.loader:Loader",
],
},
scripts=["scripts/c2cwsgiutils-run"],
)

0 comments on commit 5de6f82

Please sign in to comment.