Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ctags and better python support #292

Merged
merged 2 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ endif
LD := ld

NM := nm
PYTHON := python
CTAGS := ctags
PYTHON := $(shell tools/ci/get-python.sh)
SHELL := bash
RM := rm
LN := ln
Expand Down Expand Up @@ -230,6 +231,7 @@ clean:
$(VERBOSE) find $(KTF_ROOT) -name \*.img -delete
$(VERBOSE) find $(KTF_ROOT) -name \*.xz -delete
$(VERBOSE) find $(KTF_ROOT) -name cscope.\* -delete
$(VERBOSE) find $(KTF_ROOT) -maxdepth 1 \( -name tags -or -name TAGS \) -delete
$(VERBOSE) find $(KTF_ROOT) -name $(ASM_OFFSETS_S) -delete
$(VERBOSE) find $(KTF_ROOT) -name $(ASM_OFFSETS_H) -delete
$(VERBOSE) find $(PFMLIB_DIR) -mindepth 1 ! -name $(PFMLIB_NAME)-$(PFMLIB_VER).tar.gz -delete
Expand Down Expand Up @@ -315,6 +317,10 @@ cscope:
$(VERBOSE) $(all_sources) > cscope.files
$(VERBOSE) cscope -b -q -k

tags TAGS: $(SOURCES) $(HEADERS) $(ASM_SOURCES)
@echo "TAGS ($@)"
$(VERBOSE) $(CTAGS) -o $@ $+

.PHONY: style
style:
@echo "STYLE"
Expand Down
20 changes: 20 additions & 0 deletions tools/ci/get-python.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/sh
#
# Not all systems ship a 'python' wrapper, try version specific ones if we
# fail to find the version-agnostic one.
#
# Copyright (c) 2023 Open Source Security, Inc.

try_python() {
if $1 -c 'exit' 2>/dev/null; then
echo "$1"
exit 0
fi
}

try_python python
try_python python3
try_python python2

echo "error: python interpreter not found!" >&2
exit 1