Skip to content

Commit c282e69

Browse files
committed
Merge remote-tracking branch 'origin/main' into main
2 parents d372e95 + 44d471a commit c282e69

File tree

2 files changed

+30
-23
lines changed

2 files changed

+30
-23
lines changed

.github/workflows/build.yml

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ jobs:
4343
run: |
4444
gcc --version
4545
python3 --version
46+
- name: Check For setup.py
47+
id: need-pypi
48+
run: |
49+
echo ::set-output name=setup-py::$( find . -wholename './setup.py' )
4650
- name: New boards check
4751
run: python3 -u ci_new_boards_check.py
4852
working-directory: tools
@@ -54,6 +58,11 @@ jobs:
5458
with:
5559
name: stubs
5660
path: circuitpython-stubs*
61+
- name: Install pypi dependencies
62+
if: contains(steps.need-pypi.outputs.setup-py, 'setup.py')
63+
run: |
64+
python -m pip install --upgrade pip
65+
pip install setuptools wheel twine
5766
- name: Test Documentation Build (HTML)
5867
run: sphinx-build -E -W -b html -D version=${{ env.CP_VERSION }} -D release=${{ env.CP_VERSION }} . _build/html
5968
- uses: actions/upload-artifact@v2
@@ -108,20 +117,29 @@ jobs:
108117
with:
109118
name: mpy-cross.static-x64-windows
110119
path: mpy-cross/mpy-cross.static.exe
111-
- name: Upload stubs and mpy-cross builds to S3
120+
- name: Upload mpy-cross builds to S3
121+
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
122+
env:
123+
AWS_PAGER: ''
124+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
125+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
112126
run: |
113127
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-aarch64 s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-aarch64-${{ env.CP_VERSION }} --no-progress --region us-east-1
114128
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static-raspbian s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-raspbian-${{ env.CP_VERSION }} --no-progress --region us-east-1
115129
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-amd64-linux-${{ env.CP_VERSION }} --no-progress --region us-east-1
116130
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp mpy-cross/mpy-cross.static.exe s3://adafruit-circuit-python/bin/mpy-cross/mpy-cross.static-x64-windows-${{ env.CP_VERSION }}.exe --no-progress --region us-east-1
117131
zip -9r circuitpython-stubs.zip circuitpython-stubs
118132
[ -z "$AWS_ACCESS_KEY_ID" ] || aws s3 cp circuitpython-stubs.zip s3://adafruit-circuit-python/bin/stubs/circuitpython-stubs-${{ env.CP_VERSION }}.zip --no-progress --region us-east-1
119-
env:
120-
AWS_PAGER: ''
121-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
122-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
123-
if: github.event_name == 'push' || (github.event_name == 'release' && (github.event.action == 'published' || github.event.action == 'rerequested'))
124133
134+
- name: Upload stubs to PyPi
135+
if: github.event_name == 'push'
136+
env:
137+
TWINE_USERNAME: ${{ secrets.pypi_username }}
138+
TWINE_PASSWORD: ${{ secrets.pypi_password }}
139+
run: |
140+
echo "Uploading dev release to PyPi"
141+
python setup.py sdist
142+
twine upload dist/*
125143
126144
mpy-cross-mac:
127145
runs-on: macos-10.15

setup.py

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,16 @@
88

99
from setuptools import setup
1010
from pathlib import Path
11-
import subprocess
12-
import re
11+
12+
STD_PACKAGES = set(('array', 'math', 'os', 'random', 'struct', 'sys', 'ssl', 'time'))
1313

1414
STD_PACKAGES = set(('array', 'math', 'os', 'random', 'struct', 'sys', 'ssl', 'time'))
1515

1616
stub_root = Path("circuitpython-stubs")
1717
stubs = [p.relative_to(stub_root).as_posix() for p in stub_root.glob("*.pyi")]
1818

19-
git_out = subprocess.check_output(["git", "describe", "--tags"])
20-
version = git_out.strip().decode("utf-8")
21-
22-
# Detect a development build and mutate it to be valid semver and valid python version.
23-
pieces = version.split("-")
24-
if len(pieces) > 2:
25-
# Merge the commit portion onto the commit count since the tag.
26-
pieces[-2] += "+" + pieces[-1]
27-
pieces.pop()
28-
# Merge the commit count and build to the pre-release identifier.
29-
pieces[-2] += ".dev." + pieces[-1]
30-
pieces.pop()
31-
version = "-".join(pieces)
19+
def local_scheme(version):
20+
return ""
3221

3322
packages = set(os.listdir("circuitpython-stubs")) - STD_PACKAGES
3423
package_dir = dict((f"{package}-stubs", f"circuitpython-stubs/{package}")
@@ -49,11 +38,11 @@ def build_package_data() -> Dict[str, List[str]]:
4938
maintainer="CircuitPythonistas",
5039
maintainer_email="[email protected]",
5140
author_email="[email protected]",
52-
version=version,
5341
license="MIT",
5442
packages=list(package_data.keys()),
5543
package_data=package_data,
5644
package_dir = package_dir,
57-
setup_requires=["setuptools>=38.6.0"],
45+
setup_requires=["setuptools_scm", "setuptools>=38.6.0"],
46+
use_scm_version={"local_scheme": local_scheme},
5847
zip_safe=False,
5948
)

0 commit comments

Comments
 (0)