diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index f95ace3..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,6 +0,0 @@ -version: 2 -updates: - - package-ecosystem: "nuget" # See documentation for possible values - directory: "/" # Location of package manifests - schedule: - interval: "weekly" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9cbb5cf..e38c5d4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,9 +100,28 @@ jobs: run: | pip install numpy ./bin/Debug/tap run bin/Debug/test.TapPlan --non-interactive - - - + test-alpine: + runs-on: ubuntu-latest + container: + image: alpine:3.21 + steps: + - name: Install dependencies + run: | + apk add --no-cache \ + bash git python3 python3-dev py3-pip py3-numpy \ + dotnet-sdk-8.0 \ + icu-libs + - name: Checkout + uses: actions/checkout@v4 + - name: Restore dependencies + run: dotnet restore + - name: Build + run: dotnet build --no-restore + - name: Test + run: ./bin/Debug/tap python test + - name: Test Plan + run: ./bin/Debug/tap run bin/Debug/test.TapPlan --non-interactive + publish-package: if: github.ref == 'refs/heads/dev' || contains(github.ref, 'refs/heads/release') || contains(github.ref, 'refs/tags/v') environment: packages.opentap.io diff --git a/.gitversion b/.gitversion index a3baba2..b440777 100644 --- a/.gitversion +++ b/.gitversion @@ -3,7 +3,7 @@ # This is the version number that will be used. Prerelease numbers are calculated by # counting git commits since the last change in this value. -version = 3.2.0 +version = 3.2.1 # A version is determined to be a "beta" prerelease if it originates from the default branch # The default branch is the first branch that matches the following regular expession. diff --git a/OpenTap.Python/PythonInstallationDiscoverer.cs b/OpenTap.Python/PythonInstallationDiscoverer.cs index d3bed78..a40b855 100644 --- a/OpenTap.Python/PythonInstallationDiscoverer.cs +++ b/OpenTap.Python/PythonInstallationDiscoverer.cs @@ -49,6 +49,9 @@ static bool GetVersion(string libPath, out int major, out int minor) var sh = SharedLib.Load(libPath); + if (sh is null) + return false; + var versionSymbol = sh.GetSymbol("Py_GetVersion"); if (versionSymbol == IntPtr.Zero) return false; @@ -75,7 +78,8 @@ static IEnumerable GetPythonsInFolder(string folderPath) List pys = new List(); foreach (var dir in Directory.GetDirectories(folderPath)) { - if (Path.GetFileName(dir).Contains("Python")) + string fileName = Path.GetFileName(dir); + if (fileName.ToLower().Contains("python")) { pys.Add(dir); } @@ -101,8 +105,10 @@ static IEnumerable LocatePythonsWin32() var programFiles5 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Programs", "Python"); var programFiles6 = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles); + var programFiles7 = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "Python"); - return drives.Concat(new[] { programFiles, programFiles6, programFiles2, programFiles3, programFiles4, programFiles5 }) + return drives.Concat(new[] { programFiles, programFiles2, programFiles3, programFiles4, programFiles5, programFiles6, programFiles7 }) .SelectMany(GetPythonsInFolder).Distinct().ToArray(); } @@ -175,9 +181,14 @@ static IEnumerable LocatePythonsWin32() } } - else + else // Assume OS is Linux { - foreach(var basePath in new [] {"/usr/lib/x86_64-linux-gnu/", "/usr/lib/aarch64-linux-gnu/"} + foreach(var basePath in new [] { + "/usr/lib/x86_64-linux-gnu/", + "/usr/lib/aarch64-linux-gnu/", + "/usr/lib/" // alpine linux + + } .Where(Directory.Exists)) foreach (var python in TryFindPythons(basePath)) { @@ -239,4 +250,4 @@ static IEnumerable TryFindPythons(string path) } } } -} \ No newline at end of file +} diff --git a/README.md b/README.md index 9e20b68..f3d77c7 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,3 @@ Pythonnet is used for integrating Python and C#. The original source can be foun This plugin depends on a fork of PythonNet: [PythonNet Fork](https://github.com/pythonnet/pythonnet/): https://github.com/rmadsen-ks/pythonnet - git commit: 338b01fac14e1f8a5882949970125fe817c2d8d3 - -__Developers__ -- Lim Jing Huey -- Kyler Lee -- Gordon Ong -- Jingwei Liang -- Joseph Hoff -- Navjodh Dhillon -- Rolf Madsen (*Maintainer* @rmadsen-ks, rolf_madsen@keysight.com)