Skip to content

Commit

Permalink
Pull the jsl Python dependency separately for the Tofino back end.
Browse files Browse the repository at this point in the history
  • Loading branch information
fruffy committed Dec 12, 2024
1 parent 650af7e commit 0611777
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 13 deletions.
17 changes: 17 additions & 0 deletions backends/tofino/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,23 @@ endif()
set (ENV{P4C_VERSION} "${BFN_P4C_VERSION} (SHA: ${BFN_P4C_GIT_SHA})")
MESSAGE(STATUS "p4c-barefoot version: $ENV{P4C_VERSION}")


# Fetch and declare the jsl for schemas.
set(FETCHCONTENT_QUIET_PREV ${FETCHCONTENT_QUIET})
set(FETCHCONTENT_QUIET OFF)
fetchcontent_declare(
tofino_jsl
URL https://github.com/aromanovich/jsl/archive/refs/tags/0.2.4.tar.gz
# URL_HASH SHA256=cc01a3a05d25e5978c20be7656f14eb8b6fcb120bb1c7e8041e497814fc273cb
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/compiler_interfaces/schemas/jsl
USES_TERMINAL_DOWNLOAD TRUE
GIT_PROGRESS TRUE
DOWNLOAD_EXTRACT_TIMESTAMP TRUE
)
fetchcontent_makeavailable(tofino_jsl)
set(FETCHCONTENT_QUIET ${FETCHCONTENT_QUIET_PREV})
message("Done with setting up Python JSL for P4C.")

# Generate the sha specific version file. It includes the GIT SHA.
# Because this version changes frequently, we include it separately from the normal version files.
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/git_sha_version.h.in"
Expand Down
1 change: 1 addition & 0 deletions backends/tofino/compiler_interfaces/schemas/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jsl
2 changes: 1 addition & 1 deletion backends/tofino/compiler_interfaces/schemas/bfrt_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import json
import sys

import jsl
import jsl.jsl as jsl
import jsonschema

########################################################
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import os.path
import sys

import jsl
import jsl.jsl as jsl

MYPATH = os.path.dirname(__file__)
if not getattr(sys, 'frozen', False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import json

import jsl
import jsl.jsl as jsl

########################################################
# Schema Version
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/compiler_interfaces/schemas/jgf_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import json

import jsl
import jsl.jsl as jsl

########################################################
# Schema Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import os.path
import sys

import jsl
import jsl.jsl as jsl

MYPATH = os.path.dirname(__file__)
if not getattr(sys, 'frozen', False):
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/compiler_interfaces/schemas/mau_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import inspect
import json

import jsl
import jsl.jsl as jsl

########################################################
# Schema Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import os.path
import sys

import jsl
import jsl.jsl as jsl

MYPATH = os.path.dirname(__file__)
if not getattr(sys, 'frozen', False):
Expand Down
2 changes: 1 addition & 1 deletion backends/tofino/compiler_interfaces/schemas/phv_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import os.path
import sys

import jsl
import jsl.jsl as jsl

MYPATH = os.path.dirname(__file__)
if not getattr(sys, 'frozen', False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import inspect
import json

import jsl
import jsl.jsl as jsl

########################################################
# Schema Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import inspect
import json

import jsl
import jsl.jsl as jsl

########################################################
# Schema Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import json

import jsl
import jsl.jsl as jsl

########################################################
# Schema Version
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import json

import jsl
import jsl.jsl as jsl
from schemas.jgf_schema import Graph, GraphEdge, GraphNode, JsonGraphFormatSchema

########################################################
Expand Down
1 change: 0 additions & 1 deletion tools/ci-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ fi
function build_tofino() {
P4C_TOFINO_PACKAGES="rapidjson-dev"
sudo apt-get install -y --no-install-recommends ${P4C_TOFINO_PACKAGES}
sudo pip3 install jsl==0.2.4 pyinstaller==6.11.0
}

if [[ "${ENABLE_TOFINO}" == "ON" ]]; then
Expand Down

0 comments on commit 0611777

Please sign in to comment.