Skip to content

Commit

Permalink
ci: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasblixt committed Nov 30, 2023
1 parent 3272ad0 commit 4fff45f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
13 changes: 12 additions & 1 deletion .github/workflows/punchboot-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,22 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022]
os: [windows-latest]

steps:
- uses: actions/checkout@v4

- if: startsWith(matrix.os, 'windows') == true
name: Windows deps
uses: lukka/run-vcpkg@main
id: vcpkg
with:
pkgs: libusb
# This specifies the location of vcpkg, where it is going to be restored from cache, or create from scratch.
vcpkgDirectory: '${{ runner.workspace }}/b/vcpkg'
# The Git commit id of vcpkg to be checked out. This is only needed because we are not using a submodule.
vcpkgGitCommitId: 'c9f906558f9bb12ee9811d6edc98ec9255c6cda5'

- name: Build wheels
uses: pypa/cibuildwheel@v2.16.2
with:
Expand Down
18 changes: 15 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,19 @@
"""Punchboot setuptools configuration."""

import platform
from setuptools import setup, Extension # type: ignore

pb_base_path: str = "tools/punchboot"
plat: str = platform.system()

if plat == "Windows":
_libraries = ["libusb-1.0"]
_library_dirs = ["c:\\SPB_Data\\vcpkg\\installed\\x64-windows\\lib"]
_include_dirs = ["include", "c:\\SPB_Data\\vcpkg\\installed\\x64-windows\\include"]
else:
_libraries = ["usb-1.0"]
_library_dirs = []
_include_dirs = ["include"]

setup(
name="punchboot",
Expand Down Expand Up @@ -38,12 +49,13 @@
f"{pb_base_path}/api_slc.c",
f"{pb_base_path}/api_stream.c",
f"{pb_base_path}/usb.c",
f"{pb_base_path}/socket.c" if plat == "Linux" else "",
f"{pb_base_path}/python_wrapper.c",
f"{pb_base_path}/exceptions.c",
],
libraries=["libusb-1.0"],
library_dirs=["c:\\SPB_Data\\vcpkg\\installed\\x64-windows\\lib"],
include_dirs=["include", "c:\\SPB_Data\\vcpkg\\installed\\x64-windows\\include"],
libraries=_libraries,
library_dirs=_library_dirs,
include_dirs=_include_dirs,
)
],
install_requires=["semver>=3,<4", "click>=8,<9"],
Expand Down
5 changes: 0 additions & 5 deletions tools/punchboot/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,9 @@
#include <string.h>
#include <unistd.h>

#ifdef WINDOWS
#include <winsock2.h>
#include <Ws2tcpip.h>
#else
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/un.h>
#endif

#include "api.h"
#include "socket.h"
Expand Down

0 comments on commit 4fff45f

Please sign in to comment.