Skip to content

Commit

Permalink
remove targets as submodule, checkout via pio
Browse files Browse the repository at this point in the history
  • Loading branch information
bkleiner committed Jul 7, 2024
1 parent 4141545 commit 0c9c5b4
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,5 @@ go.mod
go.sum

/.pio
__pycache__
__pycache__
/targets
4 changes: 0 additions & 4 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
include_dir = src
build_cache_dir = .pio/cache
extra_configs =
targets/_index.ini
targets/*.ini


[common]
Expand Down
22 changes: 22 additions & 0 deletions script/pre_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,25 @@ def rewrite_source(localenv, node):


env.AddBuildMiddleware(rewrite_source)


def touch(fname, times=None):
with open(fname, "a"):
os.utime(fname, times)


target_remote = "https://github.com/BossHobby/Targets.git"
target_dir = os.path.join(env["PROJECT_DIR"], "targets")

if not os.path.exists(target_dir):
porcelain.clone(target_remote, target=target_dir, branch="targets")
touch(os.path.join(env["PROJECT_DIR"], "platformio.ini"))
else:
target_repo = porcelain.open_repo(target_dir)
target_ref_before = porcelain.describe(target_repo)
porcelain.fetch(target_repo)
porcelain.checkout_branch(target_repo, "targets")
target_ref_after = porcelain.describe(target_repo)

if target_ref_before != target_ref_after:
touch(os.path.join(env["PROJECT_DIR"], "platformio.ini"))
1 change: 0 additions & 1 deletion targets
Submodule targets deleted from 2718ce

0 comments on commit 0c9c5b4

Please sign in to comment.