Skip to content

Commit

Permalink
Build: Ensure useralerts.js is only copied for vehicles
Browse files Browse the repository at this point in the history
  • Loading branch information
stephendade authored and Hwurzburg committed Aug 24, 2020
1 parent badb0cc commit 1437da1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ clean: $(ALL_CLEAN)

%_common: %
echo "Copying common files to $</source/docs"
rsync -av common/source/docs/common-*rst $</source/docs/ && rsync -av common/source/_static/*.js $</source/_static/
rsync -av common/source/docs/common-*rst $</source/docs/

%_clean: %
$(MAKE) -C $< clean
Expand Down
1 change: 1 addition & 0 deletions common/source/_static/useralerts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Script for downloading and displaying User Alerts in the common-user-alerts.rst page
Requires a table with the css class "useralerts-list"
Written by Stephen Dade ([email protected])
[copywiki destination="copter,plane,rover,antennatracker"]
*/
$(document).ready(function() {
$.getScript("https://firmware.ardupilot.org/userAlerts/manifest.js", function() {
Expand Down
16 changes: 15 additions & 1 deletion update.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,9 +341,23 @@ def generate_copy_dict(start_dir=COMMON_DIR):
destination_file = open(targetfile, 'w', 'utf-8')
destination_file.write(content)
destination_file.close()
elif file.endswith(".css") or file.endswith(".js"):
elif file.endswith(".css"):
for wiki in ALL_WIKIS:
shutil.copy2(os.path.join(root, file), '%s/source/_static/' % wiki)
elif file.endswith(".js"):
source_file_path=os.path.join(root, file)
source_file = open(source_file_path, 'r', 'utf-8')
source_content=source_file.read()
source_file.close()
targets=get_copy_targets(source_content)
#print("JS: " + str(targets))
for wiki in targets:
content = strip_content(source_content, wiki)
targetfile='%s/source/_static/%s' % (wiki,file)
print(targetfile)
destination_file = open(targetfile, 'w', 'utf-8')
destination_file.write(content)
destination_file.close()


def get_copy_targets(content):
Expand Down

0 comments on commit 1437da1

Please sign in to comment.