-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from karelv/main
improve onboarding for other driver(sensor) contributors
- Loading branch information
Showing
64 changed files
with
7,511 additions
and
4,239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# This workflows will upload a Python Package using Twine when a release is created | ||
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries | ||
|
||
name: Upload Python Package | ||
|
||
on: | ||
release: | ||
types: [created] | ||
|
||
|
||
# on: | ||
# # Runs on pushes targeting the default branch | ||
# push: | ||
# branches: ["main"] | ||
|
||
# # Allows you to run this workflow manually from the Actions tab | ||
# workflow_dispatch: | ||
|
||
|
||
jobs: | ||
deploy: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pip-tools twine | ||
- name: Build and publish | ||
env: | ||
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | ||
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | ||
run: | | ||
cd i2c-stick-py | ||
python -m build | ||
twine upload dist/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import sys | ||
import subprocess | ||
from glob import glob | ||
|
||
DOIT_CONFIG = {'action_string_formatting': 'both', | ||
'default_tasks': ['dist', 'cleaner'], | ||
} | ||
PIP_USER = " --user " | ||
if sys.prefix != sys.base_prefix: # check if we are in a virtual environment | ||
PIP_USER = "" | ||
|
||
try: | ||
import doit | ||
except (Exception,) as e: | ||
print("Installing the doit python package.") | ||
t = subprocess.check_output('pip install {} doit'.format(PIP_USER), text=True, shell=True, stderr=subprocess.STDOUT) | ||
print(t) | ||
print("\n\nPlease run this script again") | ||
print("Note: instead of 'python dodo.py', now you can use 'doit'") | ||
print("Note: use 'doit list' for a list of commands.") | ||
exit(0) | ||
|
||
import shutil | ||
import os | ||
|
||
THIS_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
|
||
|
||
def remove(path): | ||
""" param <path> could either be relative or absolute. """ | ||
for p in glob(path): | ||
if os.path.isfile(p) or os.path.islink(p): | ||
os.remove(p) # remove the file | ||
elif os.path.isdir(p): | ||
shutil.rmtree(p) # remove dir and all contains | ||
else: | ||
raise ValueError("path {} is not a file or dir.".format(p)) | ||
|
||
|
||
def show_cmd(task): | ||
msg = task.name | ||
if task.verbosity >= 2: | ||
for action in task.actions: | ||
msg += "\n - " + str(action) | ||
return msg | ||
|
||
|
||
def task_cleaner(): | ||
""" Clean the entire repository for a git commit & be ready to re-compile the entire project!""" | ||
|
||
def do_clean(): | ||
patterns = ["dist", | ||
] | ||
for pattern in patterns: | ||
try: | ||
print(f"cleaner: {pattern}") | ||
remove(pattern) | ||
except Exception as err: | ||
print(str(err)) | ||
|
||
return { | ||
"actions": None, | ||
"clean": [(do_clean, ), | ||
"cd i2c-stick-arduino && doit clean", | ||
"cd web-interface && doit clean", | ||
], | ||
'title': show_cmd, | ||
} | ||
|
||
|
||
def task_pip(): | ||
"""Install required python packages using pip""" | ||
for rqt_file in ['web-interface/requirements.txt', 'i2c-stick-arduino/requirements.txt']: | ||
yield { | ||
'name': rqt_file, | ||
'actions': ["pip install {} -r {}".format(PIP_USER, rqt_file)], | ||
'file_dep': [rqt_file], | ||
'title': show_cmd, | ||
} | ||
|
||
|
||
def task_dist(): | ||
return { | ||
'actions': ["cd i2c-stick-arduino && doit dist", | ||
"cd web-interface && doit dist", | ||
], | ||
'verbosity': 2, | ||
'title': show_cmd, | ||
'uptodate': [False], | ||
} | ||
|
||
|
||
if __name__ == '__main__': | ||
import doit | ||
|
||
doit.run(globals()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,8 @@ | ||
*.bak | ||
*.bak | ||
.doit.db* | ||
__pycache__ | ||
package | ||
driver_cmd.h | ||
driver_cmd.cpp | ||
firmware_list.md | ||
tools |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.