diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c7c26d68..8d9deaa5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -52,7 +52,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5 + uses: github/codeql-action/init@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6 with: languages: ${{ matrix.language }} config-file: ${{ github.workspace }}/.github/codeql-config.yml @@ -83,6 +83,6 @@ jobs: run: cmake --build --preset linux-release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5 + uses: github/codeql-action/analyze@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6 with: category: "/language:${{matrix.language}}" diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index d96d89e3..ad38b442 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -112,7 +112,7 @@ jobs: # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 + uses: docker/build-push-action@af5a7ed5ba88268d5278f7203fb52cd833f66d6e with: context: . push: ${{ github.event_name != 'pull_request' }} diff --git a/.github/workflows/docker-scout-scan.yml b/.github/workflows/docker-scout-scan.yml index c685f879..9aafb5f7 100644 --- a/.github/workflows/docker-scout-scan.yml +++ b/.github/workflows/docker-scout-scan.yml @@ -89,7 +89,7 @@ jobs: # https://github.com/docker/build-push-action - name: Build and push Docker image id: build-and-push - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 + uses: docker/build-push-action@af5a7ed5ba88268d5278f7203fb52cd833f66d6e with: context: . push: false @@ -123,7 +123,7 @@ jobs: - name: Analyze for critical and high CVEs id: docker-scout-cves # if: ${{ github.event_name != 'pull_request_target' }} - uses: docker/scout-action@67eb1afe777307506aaecb9acd9a0e0389cb99ae # v1.5.0 + uses: docker/scout-action@b3dd3d6c420903eb3ff2812ac1b1d146ffb93a41 # v1.5.1 with: command: cves,recommendations image: ${{ steps.meta.outputs.tags }} @@ -133,14 +133,14 @@ jobs: - name: Upload SARIF result id: upload-sarif - uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5 + uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6 with: sarif_file: sarif.output.json - name: Docker Scout Compare to Latest id: docker-scout if: ${{ github.event_name == 'pull_request' }} - uses: docker/scout-action@67eb1afe777307506aaecb9acd9a0e0389cb99ae # v1.5.0 + uses: docker/scout-action@b3dd3d6c420903eb3ff2812ac1b1d146ffb93a41 # v1.5.1 with: command: compare image: ${{ steps.meta.outputs.tags }} diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml index e62cefca..6460a957 100644 --- a/.github/workflows/jekyll-gh-pages.yml +++ b/.github/workflows/jekyll-gh-pages.yml @@ -33,6 +33,12 @@ jobs: - name: Checkout uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Install Doxygen + run: sudo apt install -y doxygen + + - name: Generate Doxygen docs + run: doxygen ./OdbDesignLib/doxygen.conf - name: Setup Pages uses: actions/configure-pages@1f0c5cde4bc74cd7e1254d0cb4de8d49e9068c7d # v4.0.0 @@ -42,6 +48,9 @@ jobs: with: source: ./docs destination: ./_site + + # - name: Copy Doxygen docs + # run: cp -r ./OdbDesignLib/doxygen/html ./_site/api - name: Upload artifact uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 diff --git a/.github/workflows/scorecard.yml b/.github/workflows/scorecard.yml index f2af71e4..07322a41 100644 --- a/.github/workflows/scorecard.yml +++ b/.github/workflows/scorecard.yml @@ -75,6 +75,6 @@ jobs: # Upload the results to GitHub's code scanning dashboard. - name: "Upload to code-scanning" - uses: github/codeql-action/upload-sarif@47b3d888fe66b639e431abf22ebca059152f1eea # v3.24.5 + uses: github/codeql-action/upload-sarif@8a470fddafa5cbb6266ee11b37ef4d8aae19c571 # v3.24.6 with: sarif_file: results.sarif diff --git a/.gitignore b/.gitignore index 1d795bf2..4e9abb6c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,19 +4,6 @@ /.vs /out -OdbDesignLib/OdbDesignLib_wrap.cxx -PyOdbDesignLib/dist/ -PyOdbDesignLib/_PyOdbDesignLib.dll -PyOdbDesignLib/PyOdbDesignLib.py -PyOdbDesignLib/_PyOdbDesignLib.pyd -PyOdbDesignLib/__pycache__/ -PyOdbDesignServer/Lib/ -PyOdbDesignServer/PyOdbDesignServer/__pycache__/ -PyOdbDesignServer/pyvenv.cfg -PyOdbDesignServer/db.sqlite3 -PyOdbDesignServer/Scripts/ -PyOdbDesignServer/api/__pycache__/ -PyOdbDesignServer/PyOdbDesignLib/ /cmake-build-debug build/ /vcpkg_installed @@ -25,7 +12,6 @@ build/ /.idea/workspace.xml ssl/ artifacts/ -doxygen/docs/ /TEST_DATA OdbDesignTests/Testing/ Testing/ @@ -36,15 +22,9 @@ testlog.xml /OdbDesignTests/CMakeLists_Local.txt /OdbDesignTests/DesignNameTests_Local.cpp /output -OdbDesignServer/api/__pycache__/ -OdbDesignServer/api/migrations/__pycache__/ -OdbDesignServer/OdbDesignServer/__pycache__/ -OdbDesignServer/PyOdbDesignLib/__pycache__/ -OdbDesignServer/PyOdbDesignLib/PyOdbDesignLib.py -OdbDesignServer/db.sqlite3 -OdbDesignServer/PyOdbDesignLib/_PyOdbDesignLib.pyd /TEST_DATA.zip deploy/kubeconfig Dockerfile.commentedOut scripts/create-release-invoker.js /compose-designs +docs/api/ diff --git a/CMakeLists.txt b/CMakeLists.txt index da42bbf7..c02bf69c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,9 +16,6 @@ if (NOT DEFINED ENV{CI}) set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_EXE}") endif() -# required for SWIG python wrapper -#set(CMAKE_POSITION_INDEPENDENT_CODE ON) - # # GoogleTest support # @@ -58,6 +55,7 @@ if (MSVC) add_compile_options(/wd4251) # ignore C4100: 'identifier': unreferenced formal parameter add_compile_options(/wd4100) + #add_compile_options(/sdl) else() # additional warnings add_compile_options(-Wall -Wextra -Wpedantic) @@ -73,27 +71,3 @@ add_subdirectory("OdbDesignLib") add_subdirectory("OdbDesignServer") add_subdirectory("Utils") add_subdirectory("OdbDesignTests") - -# -# Doxygen -# -find_package(Doxygen) - -if (DOXYGEN_FOUND) - # set input and output files - set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/doxygen/Doxyfile.in) - set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile.out) - - # request to configure the file - configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY) - message("Configuring Doxygen") - - # Note: do not put "ALL" - this builds docs together with application EVERY TIME! - add_custom_target( docs - COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT} - WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} - COMMENT "Generating API documentation with Doxygen" - VERBATIM ) -else (DOXYGEN_FOUND) - message("Doxygen needs to be installed to generate the doxygen documentation") -endif (DOXYGEN_FOUND) diff --git a/CMakePresets.json b/CMakePresets.json index 57085208..25231dfa 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -36,16 +36,7 @@ "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" } - }, - { - "name": "python-x64-debug", - "displayName": "Python x64 Debug", - "inherits": "x64-debug", - "cacheVariables": { - "PYTHON_MODULE_BUILD": true, - "CMAKE_POSITION_INDENPENDENT_CODE": true - } - }, + }, { "name": "x64-release", "displayName": "x64 Release", @@ -53,16 +44,7 @@ "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } - }, - { - "name": "python-x64-release", - "displayName": "Python x64 Release", - "inherits": "x64-release", - "cacheVariables": { - "PYTHON_MODULE_BUILD": true, - "CMAKE_POSITION_INDENPENDENT_CODE": true - } - }, + }, { "name": "x86-debug", "displayName": "x86 Debug", @@ -123,23 +105,7 @@ "cacheVariables": { "CMAKE_BUILD_TYPE": "Release" } - }, - { - "name": "python-linux-release", - "displayName": "Python Linux Release", - "inherits": "linux-release", - "cacheVariables": { - "PYTHON_MODULE_BUILD": true - } - }, - { - "name": "python-linux-debug", - "displayName": "Python Linux Debug", - "inherits": "linux-debug", - "cacheVariables": { - "PYTHON_MODULE_BUILD": true - } - }, + }, { "name": "linux-mingw-w64-debug", "displayName": "Linux MinGW-w64 Debug", @@ -235,19 +201,7 @@ "displayName": "x86 Release", "inherits": "windows-base", "configurePreset": "x86-release" - }, - { - "name": "python-x64-debug", - "displayName": "Python x64 Debug", - "inherits": "windows-base", - "configurePreset": "python-x64-debug" - }, - { - "name": "python-x64-release", - "displayName": "Python x64 Release", - "inherits": "windows-base", - "configurePreset": "python-x64-release" - }, + }, { "name": "linux-base", "hidden": true, @@ -268,19 +222,7 @@ "displayName": "Linux Release", "configurePreset": "linux-release", "inherits": "linux-base" - }, - { - "name": "python-linux-debug", - "displayName": "Python Linux Debug", - "configurePreset": "python-linux-debug", - "inherits": "linux-base" - }, - { - "name": "python-linux-release", - "displayName": "Python Linux Release", - "configurePreset": "python-linux-release", - "inherits": "linux-base" - }, + }, { "name": "linux-mingw-w64-base", "hidden": true, @@ -357,19 +299,7 @@ "displayName": "Test x86-Release", "inherits": "windows-base", "configurePreset": "x86-release" - }, - { - "name": "python-x64-debug", - "displayName": "Test Python x64 Debug", - "inherits": "windows-base", - "configurePreset": "python-x64-debug" - }, - { - "name": "python-x64-release", - "displayName": "Test Python x64 Release", - "inherits": "windows-base", - "configurePreset": "python-x64-release" - }, + }, { "name": "linux-base", "hidden": true, @@ -390,19 +320,7 @@ "displayName": "Test Linux Release", "configurePreset": "linux-release", "inherits": "linux-base" - }, - { - "name": "python-linux-debug", - "displayName": "Test Python Linux Debug", - "configurePreset": "python-linux-debug", - "inherits": "linux-base" - }, - { - "name": "python-linux-release", - "displayName": "Test Python Linux Release", - "configurePreset": "python-linux-release", - "inherits": "linux-base" - }, + }, { "name": "linux-mingw-w64-base", "hidden": true, diff --git a/Dockerfile b/Dockerfile index 6fae52b7..df844f5d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM --platform=$BUILDPLATFORM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS build +FROM --platform=$BUILDPLATFORM debian:bookworm-20240408-slim@sha256:3d5df92588469a4c503adbead0e4129ef3f88e223954011c2169073897547cac AS build ARG OWNER=nam20485 ARG GITHUB_TOKEN="PASSWORD" @@ -66,7 +66,7 @@ RUN cmake --build --preset linux-release # RUN cmake --build --preset linux-debug # much smaller runtime image -FROM --platform=$BUILDPLATFORM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS run +FROM --platform=$BUILDPLATFORM debian:bookworm-20240408-slim@sha256:3d5df92588469a4c503adbead0e4129ef3f88e223954011c2169073897547cac AS run # ARG ODBDESIGN_SERVER_REQUEST_USERNAME="" # ARG ODBDESIGN_SERVER_REQUEST_PASSWORD="" LABEL org.opencontainers.image.source=https://github.com/nam20485/OdbDesign \ diff --git a/Dockerfile (exe) b/Dockerfile (exe) deleted file mode 100644 index e78026c7..00000000 --- a/Dockerfile (exe) +++ /dev/null @@ -1,82 +0,0 @@ -FROM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS build - -# install dependencies -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - gpg \ - curl \ - apt-transport-https \ - build-essential \ - ca-certificates \ - cmake \ - g++ \ - ninja-build \ - python3-dev \ - #python3-pip \ - #python3-virtualenv \ - # mingw-w64 \ - swig - -# add MS PowerShell repo -RUN curl https://packages.microsoft.com/keys/microsoft.asc | gpg --yes --dearmor --output /usr/share/keyrings/microsoft.gpg -RUN sh -c 'echo "deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/repos/microsoft-debian-bullseye-prod bullseye main" > /etc/apt/sources.list.d/microsoft.list' - -# install PowerShell -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - powershell - -# copy source -RUN mkdir -p /src/OdbDesign -WORKDIR /src/OdbDesign -COPY . . - -# generate SWIG python bindings -RUN chmod +x scripts/generate-python-module.ps1 -RUN scripts/generate-python-module.ps1 - -# configure & build using presets -# linux-release -RUN cmake --preset linux-release -RUN cmake --build --preset linux-release -# # linux-debug -# RUN cmake --preset linux-debug -# RUN cmake --build --preset linux-debug - -## build PyOdbDesignLib python package -#RUN python3 -m pip install -r PyOdbDesignLib/pkg-build-requirements.txt --break-system-packages -WORKDIR /src/OdbDesign/PyOdbDesignLib -# copy C++ wrapper library to a format that Python expects for extension modules -RUN cp /src/OdbDesign/out/build/linux-release/OdbDesignLib/libOdbDesign.so ./_PyOdbDesignLib.so -## build Python package -#RUN python3 -m build - -# much smaller runtime image -FROM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS run - -RUN mkdir /OdbDesign -WORKDIR /OdbDesign - -# copy binaries -RUN mkdir bin -COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignLib/libOdbDesign.so ./bin/ -COPY --from=build /src/OdbDesign/out/build/linux-release/OdbDesignApp/OdbDesignApp ./bin/ -# copy Python files -COPY --from=build /src/OdbDesign/PyOdbDesignLib /OdbDesign/PyOdbDesignLib - -# install Python3 dev -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3-dev - #python3-pip \ - #python3-virtualenv - -# # install package into Python environment -# RUN python3 -m pip install --break-system-packages \ -# --no-index \ -# --find-links PyOdbDesignLib/dist/*.whl \ -# PyOdbDesignLib - -# run -ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/OdbDesign/bin -ENTRYPOINT [ "bin/OdbDesignApp" ] diff --git a/Dockerfile_PyOdbDesignServer b/Dockerfile_PyOdbDesignServer deleted file mode 100644 index 8a91bf18..00000000 --- a/Dockerfile_PyOdbDesignServer +++ /dev/null @@ -1,68 +0,0 @@ -FROM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc AS build - -# install dependencies -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - gpg \ - curl \ - apt-transport-https \ - build-essential \ - ca-certificates \ - cmake \ - g++ \ - ninja-build \ - python3-dev \ - # mingw-w64 \ - swig \ - build-essential \ - git \ - cmake \ - zip \ - unzip \ - tar && \ - rm -rf /var/lib/apt/lists/* - -# install vcpkg -# /root/src/github/microsoft/vcpkg/scripts/buildsystems/vcpkg.cmake -WORKDIR /root/src/github/microsoft -RUN git clone https://github.com/Microsoft/vcpkg.git -WORKDIR /root/src/github/microsoft/vcpkg -RUN ./bootstrap-vcpkg.sh - -# copy source -COPY . /src/OdbDesign -WORKDIR /src/OdbDesign - -# generate SWIG python bindings -RUN chmod +x scripts/generate-python-module.sh -RUN ./scripts/generate-python-module.sh - -# configure & build using presets -# linux-release -RUN cmake --preset python-linux-release -RUN cmake --build --preset python-linux-release - -# much smaller runtime image -#FROM python:3.11.4-bullseye AS run -FROM debian:bookworm-20240211-slim@sha256:d02c76d82364cedca16ba3ed6f9102406fa9fa8833076a609cabf14270f43dfc as run - -# copy PyOdbDesignServer files -COPY --from=build /src/OdbDesign/PyOdbDesignServer PyOdbDesignServer - -# copy PyOdbDesignLib files -COPY --from=build /src/OdbDesign/out/build/python-linux-release/OdbDesignLib/_PyOdbDesignLib.so /PyOdbDesignServer/PyOdbDesignLib/ -COPY --from=build /src/OdbDesign/PyOdbDesignLib/PyOdbDesignLib.py /PyOdbDesignServer/PyOdbDesignLib/ -RUN touch /PyOdbDesignServer/PyOdbDesignLib/__init__.py - -RUN apt-get update && \ - apt-get install -y --no-install-recommends \ - python3-dev \ - python3-pip - -WORKDIR /PyOdbDesignServer -RUN python3 -m pip install -r requirements.txt --break-system-packages --require-hashes - -# run -WORKDIR /PyOdbDesignServer -EXPOSE 8000 -CMD ["gunicorn", "--bind", ":8000", "--workers", "3", "PyOdbDesignServer.wsgi:application"] diff --git a/OdbDesignLib/CMakeLists.txt b/OdbDesignLib/CMakeLists.txt index 4eaa8e1c..4e5968dc 100644 --- a/OdbDesignLib/CMakeLists.txt +++ b/OdbDesignLib/CMakeLists.txt @@ -47,9 +47,6 @@ target_compile_options(OdbDesign PUBLIC $<$: /wd4250>) -## required for SWIG -#set_property(TARGET OdbDesign PROPERTY POSITION_INDEPENDENT_CODE ON) - target_link_libraries(OdbDesign PUBLIC Utils) # state that anybody linking to us needs to include the current source dir, while we don't. @@ -90,36 +87,3 @@ target_link_libraries(OdbDesign PUBLIC protobuf::libprotobuf) # (see https://github.com/CrowCpp/Crow/issues/661#issuecomment-1702544225) list(REMOVE_ITEM _CROW_ICD "_CROW_ICD-NOTFOUND") set_target_properties(Crow::Crow PROPERTIES INTERFACE_COMPILE_DEFINITIONS "${_CROW_ICD}") - -# Python extension module build settings -if (PYTHON_MODULE_BUILD) - # # run swig to generate wrapper file - # add_custom_command(TARGET OdbDesign - # PRE_BUILD - # COMMAND scripts/generate-python-module.ps1) - - if (MSVC) - # make a copy of output library with name expected by Python module extensions - add_custom_command(TARGET OdbDesign - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy $ $/_PyOdbDesignLib.pyd - COMMENT Copying to Python module extension - ) - elseif(LINUX) - # make a copy of output library with name expected by Python module extensions - add_custom_command(TARGET OdbDesign - POST_BUILD - COMMAND ${CMAKE_COMMAND} - ARGS -E copy $ $/_PyOdbDesignLib.so - COMMENT Copying to Python module extension - ) - endif() - - target_sources(OdbDesign PRIVATE "OdbDesignLib_wrap.cxx") - - # include and link to Python3 - find_package(Python3 COMPONENTS Development REQUIRED) - #target_include_directories(OdbDesign PRIVATE ${Python3_INCLUDE_DIRS}) - target_link_libraries(OdbDesign PRIVATE Python3::Python) -endif() \ No newline at end of file diff --git a/OdbDesignLib/IProtoBuffable.h b/OdbDesignLib/IProtoBuffable.h index ffa4730c..58d4e315 100644 --- a/OdbDesignLib/IProtoBuffable.h +++ b/OdbDesignLib/IProtoBuffable.h @@ -15,6 +15,7 @@ namespace Odb::Lib class IProtoBuffable : public Utils::IJsonable { public: + // to and from Protocol Buffer messages virtual std::unique_ptr to_protobuf() const = 0; virtual void from_protobuf(const TPbMessage& message) = 0; @@ -23,8 +24,8 @@ namespace Odb::Lib bool from_pbstring(const std::string& pb_string); // to and from output and input streams - bool serializeTo(std::ostream& outputStream) const; - bool parseFrom(std::istream& inputSream); + bool to_stream(std::ostream& outputStream) const; + bool from_stream(std::istream& inputStream); // Inherited via IJsonConvertable std::string to_json() const override; @@ -57,7 +58,7 @@ namespace Odb::Lib } template - inline bool IProtoBuffable::serializeTo(std::ostream& outputStream) const + inline bool IProtoBuffable::to_stream(std::ostream& outputStream) const { auto pMessage = to_protobuf(); if (pMessage == nullptr) return false; @@ -65,10 +66,10 @@ namespace Odb::Lib } template - inline bool IProtoBuffable::parseFrom(std::istream& inputSream) + inline bool IProtoBuffable::from_stream(std::istream& inputStream) { auto pMessage = std::unique_ptr(); - if (!pMessage->ParseFromIstream(&inputSream)) return false; + if (!pMessage->ParseFromIstream(&inputStream)) return false; from_protobuf(*pMessage); return true; } diff --git a/OdbDesignLib/OdbDesignLib.i b/OdbDesignLib/OdbDesignLib.i deleted file mode 100644 index b5d34ae6..00000000 --- a/OdbDesignLib/OdbDesignLib.i +++ /dev/null @@ -1,78 +0,0 @@ -// OdbDesignLib.i -%module PyOdbDesignLib - -%header %{ -#include "ProductModel/Component.h" -#include "ProductModel/Design.h" -#include "IProtoBuffable.h" -#include "FileModel/Design/EdaDataFile.h" -#include "FileModel/OdbFile.h" -#include "FileModel/Design/MiscInfoFile.h" -#include "FileModel/Design/MatrixFile.h" -#include "FileModel/Design/StandardFontsFile.h" -#include "enums.h" -#include "FileModel/Design/FileArchive.h" -#include "FileModel/Design/LayerDirectory.h" -#include "FileModel/Design/ComponentLayerDirectory.h" -#include "ProductModel/Net.h" -#include "FileModel/Design/NetlistFile.h" -#include "ProductModel/Package.h" -#include "ProductModel/Part.h" -#include "ProductModel/Pin.h" -#include "ProductModel/PinConnection.h" -#include "FileModel/Design/StepDirectory.h" -#include "str_utils.h" -#include "ProductModel/Via.h" -//#include "edadatafile.pb.h" - -/* some objects' namespaces aren't included correctly */ -using PinConnection = Odb::Lib::ProductModel::PinConnection; -using Component = Odb::Lib::ProductModel::Component; -using Pin = Odb::Lib::ProductModel::Pin; -using Package = Odb::Lib::ProductModel::Package; -using Component = Odb::Lib::ProductModel::Component; -using namespace Odb::Lib; -//using BoardSide = Odb::Lib::BoardSide; -using StepDirectory = Odb::Lib::FileModel::Design::StepDirectory; -using MatrixFile = Odb::Lib::FileModel::Design::MatrixFile; -using StandardFontsFile = Odb::Lib::FileModel::Design::StandardFontsFile; - -%} - -// support for STL types -%include -%include -%include -%include - -// to handle declspec(dllexport) on Windows -%include -%include "odbdesign_export.h" -%include "../Utils/utils_export.h" - -// code definitions -//%include "proto/edadatafile.pb.h" -%include "IProtoBuffable.h" -%include "Net.h" -%include "Component.h" -%include "Design.h" -%include "EdaDataFile.h" -%include "OdbFile.h" -%include "MiscInfoFile.h" -%include "enums.h" -%include "FileArchive.h" -%include "LayerDirectory.h" -%include "ComponentLayerDirectory.h" -%include "Net.h" -%include "NetlistFile.h" -%include "Package.h" -%include "Part.h" -%include "Pin.h" -%include "PinConnection.h" -%include "StepDirectory.h" -%include "../Utils/str_trim.h" -%include "Via.h" -%include "StandardFontsFile.h" -%include "MatrixFile.h" - -//%template(EdaDataFileIProtoBuffable) Odb::Lib::IProtoBuffable; diff --git a/doxygen/Doxyfile.in b/OdbDesignLib/doxygen.conf similarity index 99% rename from doxygen/Doxyfile.in rename to OdbDesignLib/doxygen.conf index 6ea9fc17..8969e407 100644 --- a/doxygen/Doxyfile.in +++ b/OdbDesignLib/doxygen.conf @@ -42,7 +42,7 @@ DOXYFILE_ENCODING = UTF-8 # title of most generated pages and in a few other places. # The default value is: My Project. -PROJECT_NAME = "OdbDesign" +PROJECT_NAME = "OdbDesignLib" # The PROJECT_NUMBER tag can be used to enter a project or revision number. This # could be handy for archiving the generated documentation or if some version @@ -54,7 +54,7 @@ PROJECT_NUMBER = # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = OdbDesign ODB++ Parsing Library # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -68,8 +68,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -#OUTPUT_DIRECTORY = @CMAKE_CURRENT_BINARY_DIR@/doxygen/ -OUTPUT_DIRECTORY = @CMAKE_CURRENT_SOURCE_DIR@/doxygen/docs +OUTPUT_DIRECTORY = docs # If the CREATE_SUBDIRS tag is set to YES then doxygen will create up to 4096 # sub-directories (in 2 levels) under the output directory of each output format @@ -391,7 +390,7 @@ AUTOLINK_SUPPORT = YES # diagrams that involve STL classes more complete and accurate. # The default value is: NO. -BUILTIN_STL_SUPPORT = NO +BUILTIN_STL_SUPPORT = YES # If you use Microsoft's C++/CLI language, you should set this option to YES to # enable parsing support. @@ -525,7 +524,7 @@ EXTRACT_ALL = NO # be included in the documentation. # The default value is: NO. -EXTRACT_PRIVATE = YES +EXTRACT_PRIVATE = NO # If the EXTRACT_PRIV_VIRTUAL tag is set to YES, documented private virtual # methods of a class will be included in the documentation. @@ -944,8 +943,7 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -#INPUT = @CMAKE_CURRENT_SOURCE_DIR@ @CMAKE_CURRENT_SOURCE_DIR@/doxygen -INPUT = @CMAKE_CURRENT_SOURCE_DIR@/doxygen @CMAKE_CURRENT_SOURCE_DIR@/OdbDesignLib @CMAKE_CURRENT_SOURCE_DIR@/Utils +INPUT = ./OdbDesignLib # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -1040,7 +1038,7 @@ FILE_PATTERNS = *.c \ # be searched for input files as well. # The default value is: NO. -RECURSIVE = YES +RECURSIVE = NO # The EXCLUDE tag can be used to specify files and/or directories that should be # excluded from the INPUT source files. This way you can easily exclude a @@ -1049,13 +1047,7 @@ RECURSIVE = YES # Note that relative paths are relative to the directory from which doxygen is # run. -EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/OdbDesignLib/proto/ @CMAKE_CURRENT_SOURCE_DIR@/OdbDesignLib/OdbDesignLib_wrap.cxx @CMAKE_CURRENT_SOURCE_DIR@/doxygen/docs - -#EXCLUDE = @CMAKE_CURRENT_SOURCE_DIR@/out/ \ -# @CMAKE_CURRENT_SOURCE_DIR@/vcpkg_installed/ \ -# @CMAKE_CURRENT_SOURCE_DIR@/build/ \ -# @CMAKE_CURRENT_SOURCE_DIR@/cmake-build-* - +EXCLUDE = # The EXCLUDE_SYMLINKS tag can be used to select whether or not files or # directories that are symbolic links (a Unix file system feature) are excluded @@ -1188,7 +1180,7 @@ FORTRAN_COMMENT_AFTER = 72 # also VERBATIM_HEADERS is set to NO. # The default value is: NO. -SOURCE_BROWSER = NO +SOURCE_BROWSER = YES # Setting the INLINE_SOURCES tag to YES will include the body of functions, # classes and enums directly into the documentation. @@ -1312,7 +1304,7 @@ CLANG_DATABASE_PATH = # classes, structs, unions or interfaces. # The default value is: YES. -ALPHABETICAL_INDEX = YES +ALPHABETICAL_INDEX = NO # The IGNORE_PREFIX tag can be used to specify a prefix (or a list of prefixes) # that should be ignored while generating the index headers. The IGNORE_PREFIX @@ -1338,7 +1330,7 @@ GENERATE_HTML = YES # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_OUTPUT = html +HTML_OUTPUT = api # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). @@ -1719,7 +1711,7 @@ ECLIPSE_DOC_ID = org.doxygen.Project # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -DISABLE_INDEX = NO +DISABLE_INDEX = YES # The GENERATE_TREEVIEW tag is used to specify whether a tree-like index # structure should be generated to display hierarchical information. If the tag @@ -1736,7 +1728,7 @@ DISABLE_INDEX = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -GENERATE_TREEVIEW = NO +GENERATE_TREEVIEW = YES # When both GENERATE_TREEVIEW and DISABLE_INDEX are set to YES, then the # FULL_SIDEBAR option determines if the side bar is limited to only the treeview @@ -1748,7 +1740,7 @@ GENERATE_TREEVIEW = NO # The default value is: NO. # This tag requires that the tag GENERATE_HTML is set to YES. -FULL_SIDEBAR = NO +FULL_SIDEBAR = YES # The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that # doxygen will group on one line in the generated HTML documentation. @@ -2522,7 +2514,7 @@ HIDE_UNDOC_RELATIONS = YES # set to NO # The default value is: NO. -HAVE_DOT = YES +HAVE_DOT = NO # The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed # to run in parallel. When set to 0 doxygen will base this on the number of @@ -2690,7 +2682,7 @@ INCLUDED_BY_GRAPH = YES # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALL_GRAPH = YES +CALL_GRAPH = NO # If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller # dependency graph for every global function or class method. @@ -2702,7 +2694,7 @@ CALL_GRAPH = YES # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -CALLER_GRAPH = YES +CALLER_GRAPH = NO # If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical # hierarchy of all classes instead of a textual one. @@ -2743,7 +2735,7 @@ DIR_GRAPH_MAX_DEPTH = 1 # The default value is: png. # This tag requires that the tag HAVE_DOT is set to YES. -DOT_IMAGE_FORMAT = svg +DOT_IMAGE_FORMAT = png # If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to # enable generation of interactive SVG images that allow zooming and panning. @@ -2755,7 +2747,7 @@ DOT_IMAGE_FORMAT = svg # The default value is: NO. # This tag requires that the tag HAVE_DOT is set to YES. -INTERACTIVE_SVG = YES +INTERACTIVE_SVG = NO # The DOT_PATH tag can be used to specify the path where the dot tool can be # found. If left blank, it is assumed the dot tool can be found in the path. diff --git a/OdbDesignServer/Controllers/DesignsController.cpp b/OdbDesignServer/Controllers/DesignsController.cpp index e5c5b22b..8390f70f 100644 --- a/OdbDesignServer/Controllers/DesignsController.cpp +++ b/OdbDesignServer/Controllers/DesignsController.cpp @@ -168,6 +168,17 @@ namespace Odb::App::Server return crow::response(crow::status::BAD_REQUEST, "design name not specified"); } + bool excludeFileArchive = false; + auto szExcludeFileArchive = req.url_params.get(kszExcludeFileArchiveQueryParamName); + if (szExcludeFileArchive != nullptr) + { + if (std::strcmp(szExcludeFileArchive, "true") == 0 || + std::strcmp(szExcludeFileArchive, "yes") == 0) + { + excludeFileArchive = true; + } + } + auto pDesign = m_serverApp.designs().GetDesign(designNameDecoded); if (pDesign == nullptr) { diff --git a/OdbDesignServer/Controllers/DesignsController.h b/OdbDesignServer/Controllers/DesignsController.h index fb150897..42b30262 100644 --- a/OdbDesignServer/Controllers/DesignsController.h +++ b/OdbDesignServer/Controllers/DesignsController.h @@ -13,6 +13,8 @@ namespace Odb::App::Server // Inherited via RouteController void register_routes() override; + constexpr inline static const char* kszExcludeFileArchiveQueryParamName = "exclude_filearchive"; + private: crow::response designs_list_route_handler(const crow::request& req); diff --git a/OdbDesignServer/Controllers/FileUploadController.cpp b/OdbDesignServer/Controllers/FileUploadController.cpp index d2b133b7..ad9b2d81 100644 --- a/OdbDesignServer/Controllers/FileUploadController.cpp +++ b/OdbDesignServer/Controllers/FileUploadController.cpp @@ -127,7 +127,10 @@ namespace Odb::App::Server { // log to debug and skip rest of the loop CROW_LOG_DEBUG << " Value: " << part_value.body << '\n'; - CROW_LOG_ERROR << "multipart/form-data POST failed! Part name was: [" << part_name << "], which is not supported. Part name should be [" << MULTIPART_FORMDATA_PART_NAME << "]."; + CROW_LOG_ERROR + << "multipart/form-data POST failed! Part name was: [" << part_name + << "], which is not supported. Part name should be [" << MULTIPART_FORMDATA_PART_NAME + << "]."; continue; } diff --git a/PyOdbDesignLib/LICENSE b/PyOdbDesignLib/LICENSE deleted file mode 100644 index a6f4bcca..00000000 --- a/PyOdbDesignLib/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Nathan Miller - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/PyOdbDesignLib/README.md b/PyOdbDesignLib/README.md deleted file mode 100644 index dc9c8f8b..00000000 --- a/PyOdbDesignLib/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# PyOdbDesignLib - -## Description - -Thin Python3 wrapper for the (C++) OdbDesignLib. - -## OdbDesignLib - -A free open source cross-platform C++ library for parsing ODB++ Design archives and building net list product models with a Python server exposing a REST API, all packaged inside of a Docker image. - -* [GitHub](https://github.com/nam20485/odbdesign) -* [License](https://github.com/nam20485/OdbDesign/blob/c0c8b6e4b93e1c7d4d5e65c7ad25157c883f8bfb/LICENSE) -* [Contact](mailto:nmiller217@gmail.com?subject=OdbDesign) diff --git a/PyOdbDesignLib/Utilities.py b/PyOdbDesignLib/Utilities.py deleted file mode 100644 index d8a129d6..00000000 --- a/PyOdbDesignLib/Utilities.py +++ /dev/null @@ -1,13 +0,0 @@ -from PyOdbDesignLib import PyOdbDesignLib - - -def load_file_archive(path): - """ - This function loads a FileArchive object from disk and returns it. - """ - try: - file_archive = PyOdbDesignLib.FileArchive(path) - return file_archive - except Exception as e: - print("Error: {}".format(e)) - return None diff --git a/PyOdbDesignLib/__init__.py b/PyOdbDesignLib/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/PyOdbDesignLib/pkg-build-requirements.txt b/PyOdbDesignLib/pkg-build-requirements.txt deleted file mode 100644 index d2ccba17..00000000 --- a/PyOdbDesignLib/pkg-build-requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -build==0.10.0 -twine==4.0.2 diff --git a/PyOdbDesignLib/pyproject.toml b/PyOdbDesignLib/pyproject.toml deleted file mode 100644 index d11b6b8e..00000000 --- a/PyOdbDesignLib/pyproject.toml +++ /dev/null @@ -1,28 +0,0 @@ -[build-system] -requires = ["hatchling"] -build-backend = "hatchling.build" - -[project] -name = "PyOdbDesignLib" -version = "0.0.1" -authors = [{ name = "Nathan Miller", email = "nmiller217+odbdesign@gmail.com" }] -maintainers = [{ name = "Nathan Miller", email = "nmiller217@gmail.com" }] -description = "Thin Python3 wrapper for the (C++) OdbDesignLib" -readme = "README.md" -license = { file = "LICENSE" } -requires-python = ">=3.7" -classifiers = [ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: MIT License", - #"Operating System :: OS Independent", - "Operating System :: POSIX :: Linux", -] -keywords = [ - "Odb", - "Odb++" -] - -[project.urls] -"Homepage" = "https://nam20485.github.io/OdbDesign/" -"Repository" = "https://github.com/nam20485/OdbDesign" -"Bug Tracker" = "https://github.com/nam20485/OdbDesign/issues" diff --git a/PyOdbDesignServer/PyOdbDesignServer/__init__.py b/PyOdbDesignServer/PyOdbDesignServer/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/PyOdbDesignServer/PyOdbDesignServer/asgi.py b/PyOdbDesignServer/PyOdbDesignServer/asgi.py deleted file mode 100644 index b3184e32..00000000 --- a/PyOdbDesignServer/PyOdbDesignServer/asgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -ASGI config for PyOdbDesignServer project. - -It exposes the ASGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ -""" - -import os - -from django.core.asgi import get_asgi_application - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PyOdbDesignServer.settings') - -application = get_asgi_application() diff --git a/PyOdbDesignServer/PyOdbDesignServer/settings.py b/PyOdbDesignServer/PyOdbDesignServer/settings.py deleted file mode 100644 index 23644261..00000000 --- a/PyOdbDesignServer/PyOdbDesignServer/settings.py +++ /dev/null @@ -1,123 +0,0 @@ -""" -Django settings for PyOdbDesignServer project. - -Generated by 'django-admin startproject' using Django 4.2.2. - -For more information on this file, see -https://docs.djangoproject.com/en/4.2/topics/settings/ - -For the full list of settings and their values, see -https://docs.djangoproject.com/en/4.2/ref/settings/ -""" - -from pathlib import Path - -# Build paths inside the project like this: BASE_DIR / 'subdir'. -BASE_DIR = Path(__file__).resolve().parent.parent - - -# Quick-start development settings - unsuitable for production -# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ - -# SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-oz6ev5(zc@cw&75*fbcs@z(i&2q3aw=6i4!6qg2wx5#)v4y2b+' - -# SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True - -ALLOWED_HOSTS = [] - - -# Application definition - -INSTALLED_APPS = [ - 'django.contrib.admin', - 'django.contrib.auth', - 'django.contrib.contenttypes', - 'django.contrib.sessions', - 'django.contrib.messages', - 'django.contrib.staticfiles', -] - -MIDDLEWARE = [ - 'django.middleware.security.SecurityMiddleware', - 'django.contrib.sessions.middleware.SessionMiddleware', - 'django.middleware.common.CommonMiddleware', - 'django.middleware.csrf.CsrfViewMiddleware', - 'django.contrib.auth.middleware.AuthenticationMiddleware', - 'django.contrib.messages.middleware.MessageMiddleware', - 'django.middleware.clickjacking.XFrameOptionsMiddleware', -] - -ROOT_URLCONF = 'PyOdbDesignServer.urls' - -TEMPLATES = [ - { - 'BACKEND': 'django.template.backends.django.DjangoTemplates', - 'DIRS': [], - 'APP_DIRS': True, - 'OPTIONS': { - 'context_processors': [ - 'django.template.context_processors.debug', - 'django.template.context_processors.request', - 'django.contrib.auth.context_processors.auth', - 'django.contrib.messages.context_processors.messages', - ], - }, - }, -] - -WSGI_APPLICATION = 'PyOdbDesignServer.wsgi.application' - - -# Database -# https://docs.djangoproject.com/en/4.2/ref/settings/#databases - -DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } -} - - -# Password validation -# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators - -AUTH_PASSWORD_VALIDATORS = [ - { - 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', - }, - { - 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', - }, -] - - -# Internationalization -# https://docs.djangoproject.com/en/4.2/topics/i18n/ - -LANGUAGE_CODE = 'en-us' - -TIME_ZONE = 'UTC' - -USE_I18N = True - -USE_TZ = True - - -# Static files (CSS, JavaScript, Images) -# https://docs.djangoproject.com/en/4.2/howto/static-files/ - -STATIC_URL = 'static/' - -# Default primary key field type -# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field - -DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField' diff --git a/PyOdbDesignServer/PyOdbDesignServer/urls.py b/PyOdbDesignServer/PyOdbDesignServer/urls.py deleted file mode 100644 index 584671db..00000000 --- a/PyOdbDesignServer/PyOdbDesignServer/urls.py +++ /dev/null @@ -1,23 +0,0 @@ -""" -URL configuration for PyOdbDesignServer project. - -The `urlpatterns` list routes URLs to views. For more information please see: - https://docs.djangoproject.com/en/4.2/topics/http/urls/ -Examples: -Function views - 1. Add an import: from my_app import views - 2. Add a URL to urlpatterns: path('', views.home, name='home') -Class-based views - 1. Add an import: from other_app.views import Home - 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') -Including another URLconf - 1. Import the include() function: from django.urls import include, path - 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) -""" -from django.contrib import admin -from django.urls import path, include - -urlpatterns = [ - path("api/", include("api.urls")), - path('admin/', admin.site.urls), -] diff --git a/PyOdbDesignServer/PyOdbDesignServer/wsgi.py b/PyOdbDesignServer/PyOdbDesignServer/wsgi.py deleted file mode 100644 index bdd8c94c..00000000 --- a/PyOdbDesignServer/PyOdbDesignServer/wsgi.py +++ /dev/null @@ -1,16 +0,0 @@ -""" -WSGI config for PyOdbDesignServer project. - -It exposes the WSGI callable as a module-level variable named ``application``. - -For more information on this file, see -https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/ -""" - -import os - -from django.core.wsgi import get_wsgi_application - -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PyOdbDesignServer.settings') - -application = get_wsgi_application() diff --git a/PyOdbDesignServer/api/__init__.py b/PyOdbDesignServer/api/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/PyOdbDesignServer/api/admin.py b/PyOdbDesignServer/api/admin.py deleted file mode 100644 index 8c38f3f3..00000000 --- a/PyOdbDesignServer/api/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.contrib import admin - -# Register your models here. diff --git a/PyOdbDesignServer/api/apps.py b/PyOdbDesignServer/api/apps.py deleted file mode 100644 index 66656fd2..00000000 --- a/PyOdbDesignServer/api/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class ApiConfig(AppConfig): - default_auto_field = 'django.db.models.BigAutoField' - name = 'api' diff --git a/PyOdbDesignServer/api/migrations/__init__.py b/PyOdbDesignServer/api/migrations/__init__.py deleted file mode 100644 index e69de29b..00000000 diff --git a/PyOdbDesignServer/api/models.py b/PyOdbDesignServer/api/models.py deleted file mode 100644 index 71a83623..00000000 --- a/PyOdbDesignServer/api/models.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.db import models - -# Create your models here. diff --git a/PyOdbDesignServer/api/tests.py b/PyOdbDesignServer/api/tests.py deleted file mode 100644 index 7ce503c2..00000000 --- a/PyOdbDesignServer/api/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -from django.test import TestCase - -# Create your tests here. diff --git a/PyOdbDesignServer/api/urls.py b/PyOdbDesignServer/api/urls.py deleted file mode 100644 index a9d7f56e..00000000 --- a/PyOdbDesignServer/api/urls.py +++ /dev/null @@ -1,7 +0,0 @@ -from django.urls import path - -from . import views - -urlpatterns = [ - path("", views.index, name="index"), -] \ No newline at end of file diff --git a/PyOdbDesignServer/api/views.py b/PyOdbDesignServer/api/views.py deleted file mode 100644 index 141b1768..00000000 --- a/PyOdbDesignServer/api/views.py +++ /dev/null @@ -1,8 +0,0 @@ -from django.shortcuts import render -from django.http import HttpResponse -from PyOdbDesignLib import PyOdbDesignLib - - -def index(request): - net = PyOdbDesignLib.Net("net1", 0) - return HttpResponse("Hello, world. You're at the api index. net name: " + net.GetName() + " net id: " + str(net.GetIndex())) diff --git a/PyOdbDesignServer/manage.py b/PyOdbDesignServer/manage.py deleted file mode 100644 index ce90d6a9..00000000 --- a/PyOdbDesignServer/manage.py +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env python -"""Django's command-line utility for administrative tasks.""" -import os -import sys - - -def main(): - """Run administrative tasks.""" - os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'PyOdbDesignServer.settings') - try: - from django.core.management import execute_from_command_line - except ImportError as exc: - raise ImportError( - "Couldn't import Django. Are you sure it's installed and " - "available on your PYTHONPATH environment variable? Did you " - "forget to activate a virtual environment?" - ) from exc - execute_from_command_line(sys.argv) - - -if __name__ == '__main__': - main() diff --git a/PyOdbDesignServer/requirements.in b/PyOdbDesignServer/requirements.in deleted file mode 100644 index bcffb2c1..00000000 --- a/PyOdbDesignServer/requirements.in +++ /dev/null @@ -1,6 +0,0 @@ -#Django==4.2.6 -#gunicorn==21.2.0 -#DjangoRestFramework==3.14.0 -Django -gunicorn -DjangoRestFramework \ No newline at end of file diff --git a/PyOdbDesignServer/requirements.txt b/PyOdbDesignServer/requirements.txt deleted file mode 100644 index a1fd0426..00000000 --- a/PyOdbDesignServer/requirements.txt +++ /dev/null @@ -1,36 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile --generate-hashes --no-emit-index-url -# -asgiref==3.7.2 \ - --hash=sha256:89b2ef2247e3b562a16eef663bc0e2e703ec6468e2fa8a5cd61cd449786d4f6e \ - --hash=sha256:9e0ce3aa93a819ba5b45120216b23878cf6e8525eb3848653452b4192b92afed - # via django -django==5.0.2 \ - --hash=sha256:56ab63a105e8bb06ee67381d7b65fe6774f057e41a8bab06c8020c8882d8ecd4 \ - --hash=sha256:b5bb1d11b2518a5f91372a282f24662f58f66749666b0a286ab057029f728080 - # via - # -r requirements.in - # djangorestframework -djangorestframework==3.14.0 \ - --hash=sha256:579a333e6256b09489cbe0a067e66abe55c6595d8926be6b99423786334350c8 \ - --hash=sha256:eb63f58c9f218e1a7d064d17a70751f528ed4e1d35547fdade9aaf4cd103fd08 - # via -r requirements.in -gunicorn==21.2.0 \ - --hash=sha256:3213aa5e8c24949e792bcacfc176fef362e7aac80b76c56f6b5122bf350722f0 \ - --hash=sha256:88ec8bff1d634f98e61b9f65bc4bf3cd918a90806c6f5c48bc5603849ec81033 - # via -r requirements.in -packaging==23.2 \ - --hash=sha256:048fb0e9405036518eaaf48a55953c750c11e1a1b68e0dd1a9d62ed0c092cfc5 \ - --hash=sha256:8c491190033a9af7e1d931d0b5dacc2ef47509b34dd0de67ed209b5203fc88c7 - # via gunicorn -pytz==2023.3.post1 \ - --hash=sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b \ - --hash=sha256:ce42d816b81b68506614c11e8937d3aa9e41007ceb50bfdcb0749b921bf646c7 - # via djangorestframework -sqlparse==0.4.4 \ - --hash=sha256:5430a4fe2ac7d0f93e66f1efc6e1338a41884b7ddf2a350cedd20ccc4d9d28f3 \ - --hash=sha256:d446183e84b8349fa3061f0fe7f06ca94ba65b426946ffebe6e3e8295332420c - # via django diff --git a/docs/README.md b/docs/README.md index 59de4cce..8ce944cc 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ # OdbDesign -A free open source cross-platform C++ library for parsing ODB++ Design archives, accessing their data, and building net list product models. Exposed via a REST API and packaged inside of a Docker image. +A free open source cross-platform C++ library for parsing ODB++ Design archives, accessing their data, and building net list product models. Exposed via a REST API packaged inside of a Docker image. ## Key Features @@ -175,18 +175,12 @@ $ docker build . -t odbdesign-server ## Integration into Other Applications -There are four interfaces that allow use of the library in other applications. +There are three interfaces that allow use of the library in other applications. ### C++ Shared Library ### REST API -### Python Object Interface - -SWIG is used to create a Python interface to the C++ library. The interface is exposed as a Python package that can be installed using pip. Parsing is supported, but currently not all data is available to access via the Python interface. - ->Using the Python interface for anything beyond basic parsing would require implementation of Python wrapper classes to hold the data you are interested in. A better route for Python integration is probably to use the REST API or to generate Python bindings automatically using the included Google Protobuf definitions. - ### Google Protobuf Protocol Buffers Data objects returned from the parser library support serialization to and from [Google Protobuf protocol buffers](https://protobuf.dev/). This allows the data to be easily shared with other applications and programming languages that support protocol buffers. Google Protobuf is a highly optimized binary encoding so it is fast and small. diff --git a/scripts/generate-python-module.cmd b/scripts/generate-python-module.cmd deleted file mode 100644 index 445396ec..00000000 --- a/scripts/generate-python-module.cmd +++ /dev/null @@ -1 +0,0 @@ -swig -c++ -outdir ./PyOdbDesignLib -python ./OdbDesignLib/OdbDesignLib.i \ No newline at end of file diff --git a/scripts/generate-python-module.sh b/scripts/generate-python-module.sh deleted file mode 100644 index 1d59d50a..00000000 --- a/scripts/generate-python-module.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -#swig -c++ -outdir ./PyOdbDesignLib -python ./OdbDesignLib/OdbDesignLib.i - -# "include" the .cmd file by 'source' executing here, -# so we don't have to duplicate the commands and -# can keep them in one place -source scripts/generate-python-module.cmd \ No newline at end of file