-
Notifications
You must be signed in to change notification settings - Fork 178
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(api): Add infrastructure for a br2-external tree for buildroot (#…
…3217) * chore(api): Add infrastructure for a br2-external tree for buildroot More information can be found in https://buildroot.org/downloads/manual/manual.html. This change doesn't alter the normal build infrastructure; it's only used when included by buildroot externally. This tooling provides definitions for our api server and a unit file to bring it up using systemd.
- Loading branch information
Showing
9 changed files
with
115 additions
and
16 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,3 @@ | ||
# Configuration for Buildroot integration | ||
source "$BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH/api/Config.in" | ||
# source "$BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH/update-server/Config.in" |
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,11 @@ | ||
config BR2_PACKAGE_PYTHON_OPENTRONS_API | ||
bool "python-opentrons-api" | ||
depends on BR2_PACKAGE_PYTHON3 | ||
select BR2_PACKAGE_PYTHON_NUMPY # runtime | ||
select BR2_PACKAGE_PYTHON_SERIAL # runtime | ||
select BR2_PACKAGE_PYTHON_URWID # runtime | ||
select BR2_PACKAGE_PYTHON_AIOHTTP # runtime | ||
help | ||
Opentrons API server. Controls an OT2 robot. | ||
|
||
https://opentrons.com |
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,45 @@ | ||
################################################################################ | ||
# | ||
# python-opentrons-api | ||
# | ||
################################################################################ | ||
|
||
# Get a key from package.json (like version) | ||
define get_pkg_json_key | ||
$(shell python -c "import json; print(json.load(open('$(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH)/api/src/opentrons/package.json'))[\"$(1)\"])") | ||
endef | ||
|
||
PYTHON_OPENTRONS_API_VERSION = $(call get_pkg_json_key,version) | ||
PYTHON_OPENTRONS_API_LICENSE = $(call get_pkg_json_key,license) | ||
PYTHON_OPENTRONS_API_LICENSE_FILES = $(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH)/LICENSE | ||
PYTHON_OPENTRONS_API_SETUP_TYPE = setuptools | ||
PYTHON_OPENTRONS_API_SITE_METHOD = local | ||
PYTHON_OPENTRONS_API_SITE = $(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH) | ||
PYTHON_OPENTRONS_API_SUBDIR = api | ||
PYTHON_OPENTRONS_API_POST_INSTALL_TARGET_HOOKS = PYTHON_OPENTRONS_API_INSTALL_VERSION | ||
|
||
define DUMP_BR_VERSION | ||
$(shell python 2>&1 $(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH)/api/build_tools.py dump_br_version) | ||
endef | ||
|
||
define PYTHON_OPENTRONS_API_INSTALL_VERSION | ||
echo '$(call DUMP_BR_VERSION)' > $(BINARIES_DIR)/opentrons-api-version.json | ||
endef | ||
|
||
ot_api_name := python-opentrons-api | ||
|
||
define PYTHON_OPENTRONS_API_INSTALL_INIT_SYSTEMD | ||
$(INSTALL) -D -m 0644 $(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH)/api/opentrons-api-server.service \ | ||
$(TARGET_DIR)/etc/systemd/system/opentrons-api-server.service | ||
|
||
mkdir -p $(TARGET_DIR)/etc/systemd/system/opentrons.target.wants | ||
|
||
ln -sf ../opentrons-api-server.service \ | ||
$(TARGET_DIR)/etc/systemd/system/opentrons.target.wants/opentrons-api-server.service | ||
endef | ||
|
||
# Calling inner-python-package directly instead of using python-package macro | ||
# because our directory layout doesn’t conform to buildroot’s expectation of | ||
# having the directory name be the package name | ||
$(eval $(call inner-python-package,python-opentrons-api,$(call UPPERCASE,$(ot_api_name)),$(call UPPERCASE,$(ot_api_name)),target)) | ||
|
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,12 @@ | ||
[Unit] | ||
Description=Opentrons API server | ||
Requires=nginx.service | ||
After=nginx.service | ||
|
||
[Service] | ||
Type=exec | ||
ExecStart=python -m opentrons.main -U /run/aiohttp.sock | ||
Environment=OT_SMOOTHIE_ID=AMA | ||
|
||
[Install] | ||
WantedBy=opentrons.target |
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,2 @@ | ||
name: OPENTRONS_MONOREPO | ||
desc: Tree containing Opentrons API and update infrastructure |
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,3 @@ | ||
# Makefile inclusions for buildroot integration | ||
include $(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH)/api/buildroot.mk | ||
# include $(BR2_EXTERNAL_OPENTRONS_MONOREPO_PATH)/update-server/buildroot.mk |