Skip to content

Commit e008b2a

Browse files
update header to v923.11 and fix uv build
fixed license warning add read the doc changes rtd fix
1 parent dc5efcc commit e008b2a

6 files changed

Lines changed: 227 additions & 38 deletions

File tree

.github/workflows/docs.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Documentation
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
- '*.*.*'
8+
9+
jobs:
10+
trigger-docs:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Trigger Read the Docs Build
14+
run: |
15+
# Create request body
16+
BODY='{}'
17+
18+
# Create HMAC-SHA256 signature
19+
SIGNATURE=$(echo -n "$BODY" | openssl dgst -sha256 -hmac "${{ secrets.RTD_WEBHOOK_TOKEN }}" -binary | xxd -p -c 256)
20+
21+
# Send request to Read the Docs webhook
22+
curl -X POST \
23+
-H "X-RTD-Signature: sha256=$SIGNATURE" \
24+
-H "Content-Type: application/json" \
25+
-d "$BODY" \
26+
https://app.readthedocs.org/api/v2/webhook/python-ics/319966/

ics_utility.py

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,31 @@
11
import os
22
import dunamai
33
import pathlib
4+
import re
45

56
GEN_DIR = pathlib.Path("./gen")
67
GEN_ICS_DIR = GEN_DIR / "ics"
78

9+
10+
def _get_version_from_metadata() -> str:
11+
"""
12+
Try to read version from existing package metadata (PKG-INFO).
13+
Used as fallback when building from sdist in isolated environment.
14+
"""
15+
# Check for PKG-INFO in the egg-info directory
16+
egg_info_dirs = list(pathlib.Path(".").glob("*.egg-info"))
17+
if egg_info_dirs:
18+
pkg_info = egg_info_dirs[0] / "PKG-INFO"
19+
if pkg_info.exists():
20+
try:
21+
content = pkg_info.read_text()
22+
match = re.search(r"^Version:\s+(.+)$", content, re.MULTILINE)
23+
if match:
24+
return match.group(1)
25+
except Exception:
26+
pass
27+
return None
28+
829
def get_pkg_version() -> str:
930
"""
1031
Get the package version.
@@ -18,7 +39,16 @@ def get_pkg_version() -> str:
1839
# pkg_version = version.serialize(format="v{base}.dev{distance}", style=dunamai.Style.Pep440)
1940
# else:
2041
# pkg_version = version.serialize(format="{base}", style=dunamai.Style.Pep440)
21-
return dunamai.Version.from_git().serialize(metadata=False)
42+
try:
43+
return dunamai.Version.from_git().serialize(metadata=False)
44+
except RuntimeError:
45+
# Fallback when git is not available (e.g., in isolated build environments)
46+
# Try to read version from existing package metadata
47+
metadata_version = _get_version_from_metadata()
48+
if metadata_version:
49+
return metadata_version
50+
# Final fallback
51+
return "0.0.0.dev0"
2252
# return pkg_version
2353

2454
def create_version_py(path: pathlib.Path = pathlib.Path("gen/ics/__version.py")) -> None:
@@ -32,7 +62,11 @@ def create_version_py(path: pathlib.Path = pathlib.Path("gen/ics/__version.py"))
3262
None
3363
"""
3464
pkg_version = get_pkg_version()
35-
full_version = dunamai.Version.from_git().serialize(format="v{base}-{commit}-{timestamp}")
65+
try:
66+
full_version = dunamai.Version.from_git().serialize(format="v{base}-{commit}-{timestamp}")
67+
except RuntimeError:
68+
# Fallback when git is not available
69+
full_version = f"v{pkg_version}"
3670
print(f"Creating '{path}' with version {pkg_version} and full version {full_version}...")
3771
path.parent.mkdir(parents=True, exist_ok=True)
3872
# Write the version file to disk

include/ics/icsnVC40.h

Lines changed: 14 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -464,11 +464,6 @@ typedef struct _NeoDeviceEx
464464
#define DRIVER_USB1 (0x40)
465465
#define DRIVER_USB2 (0x80)
466466
#define DRIVER_USB3 (0xC0)
467-
#define SERVD_DRIVER_MASK (0xFF00)
468-
#define SERVD_DRIVER_VCP (0x0100)
469-
#define SERVD_DRIVER_DXX (0x0200)
470-
#define SERVD_DRIVER_CAB (0x0400)
471-
#define SERVD_DRIVER_TCP (0x1000)
472467
uint32_t Options;
473468

474469
void* pAvailWIFINetwork;
@@ -479,7 +474,7 @@ typedef struct _NeoDeviceEx
479474
uint8_t MACAddress[6];
480475
uint16_t hardwareRev;
481476
uint16_t revReserved;
482-
uint32_t tcpIpAddress[4];
477+
uint32_t ipAddress[4];
483478
uint16_t tcpPort;
484479
uint16_t Reserved0;
485480
uint32_t Reserved1;
@@ -1236,7 +1231,9 @@ typedef struct OP_ETH_SETTINGS_t
12361231
uint16_t snf_tap : 1; // store and forward
12371232
uint16_t disable_tap_to_host : 1;
12381233
uint16_t show_tap_tx_receipt : 1;
1239-
uint16_t reserved : 5;
1234+
uint16_t tap_dest : 2;
1235+
uint16_t tc10_tap : 1;
1236+
uint16_t reserved : 2;
12401237
};
12411238
uint8_t reserved0[14];
12421239
};
@@ -1277,6 +1274,10 @@ typedef struct ETHERNET_SETTINGS_t
12771274
#define ETHERNET_SETTINGS2_FLAG2_TAP_DEST_SHIFT 13
12781275
#define ETHERNET_SETTINGS2_FLAG2_TAP_DEST_MASK 0x3
12791276
#define ETHERNET_SETTINGS2_FLAG2_TC10_FWD_TAP_ENABLE 0x8000
1277+
#define ETHERNET_SETTINGS2_FLAG2_GET_TAP_DEST(s) \
1278+
(((s)->flags2 >> ETHERNET_SETTINGS2_FLAG2_TAP_DEST_SHIFT) & ETHERNET_SETTINGS2_FLAG2_TAP_DEST_MASK)
1279+
#define ETHERNET_SETTINGS2_FLAG2_SET_TAP_DEST(s, d) \
1280+
((s)->flags2 |= ((d)&ETHERNET_SETTINGS2_FLAG2_TAP_DEST_MASK) << ETHERNET_SETTINGS2_FLAG2_TAP_DEST_SHIFT)
12801281

12811282
typedef enum
12821283
{
@@ -1839,11 +1840,13 @@ typedef struct _wBMSManagerReset
18391840
uint8_t managerIndex;
18401841
} wBMSManagerReset;
18411842

1843+
#define UART_DATA_BUFFER_SIZE 256
1844+
18421845
typedef struct _UartPortData
18431846
{
18441847
uint16_t len;
18451848
uint8_t port;
1846-
uint8_t bData[256];
1849+
uint8_t bData[UART_DATA_BUFFER_SIZE];
18471850
} UartPortData;
18481851

18491852
typedef struct _UartPortPortBytes
@@ -5550,23 +5553,8 @@ typedef enum _epsilon10GPHYFW
55505553
#define NUM_DEVICE_FEATURE_BITFIELDS ((NUM_VALID_DEVICE_FEATURES + 31) / 32)
55515554

55525555

5553-
#if !defined(INTREPID_NO_CHECK_STRUCT_SIZE) && !defined(ics_static_assert)
5554-
5555-
#if (defined(__cplusplus) && (__cplusplus > 199711L))
5556-
#define ics_static_assert(e, msg) static_assert(e, msg)
5557-
#define CHECK_STRUCT_SIZE(X) ics_static_assert(sizeof(X) == X##_SIZE, #X " is the wrong size");
5558-
#else
5559-
#define ASSERT_CONCAT_(a, b) a##b
5560-
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
5561-
#define ics_static_assert(e, msg) \
5562-
enum \
5563-
{ \
5564-
ASSERT_CONCAT(assert_line_, __LINE__) = 1 / (int)(!!(e)) \
5565-
}
5566-
#define CHECK_STRUCT_SIZE(X) ics_static_assert(sizeof(X) == X##_SIZE, #X " is the wrong size");
5567-
#endif
5568-
5569-
5556+
#if !defined(INTREPID_NO_CHECK_STRUCT_SIZE) && defined(__cpp_static_assert)
5557+
#define CHECK_STRUCT_SIZE(X) static_assert(sizeof(X) == X##_SIZE, #X " is the wrong size");
55705558
CHECK_STRUCT_SIZE(CAN_SETTINGS);
55715559
CHECK_STRUCT_SIZE(CANFD_SETTINGS);
55725560
CHECK_STRUCT_SIZE(SWCAN_SETTINGS);
@@ -5642,7 +5630,7 @@ CHECK_STRUCT_SIZE(SRADGigastar2Settings);
56425630
CHECK_STRUCT_SIZE(SRADMoonT1SSettings);
56435631
CHECK_STRUCT_SIZE(SNeoVIConnectSettings);
56445632
CHECK_STRUCT_SIZE(FlashAccessoryFirmwareParams);
5645-
5633+
#undef CHECK_STRUCT_SIZE
56465634
#endif /* INTREPID_NO_CHECK_STRUCT_SIZE */
56475635

56485636
#endif /* _ICSNVC40_H */

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "Python wrapper for interfacing to IntrepidCS Hardware."
77
keywords = ["intrepidcs", "CAN", "Ethernet", "Automotive", "ICS"]
88
readme = { file = "README.md", content-type = "text/markdown" }
99
requires-python = ">=3.10"
10-
license = { file = "LICENSE.md" }
10+
license = "MIT"
1111
classifiers = [
1212
"Development Status :: 5 - Production/Stable",
1313
"Intended Audience :: Developers",

src/setup_module_auto_defines.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -345,11 +345,6 @@ int setup_module_auto_defines(PyObject * module)
345345
result += PyModule_AddObjectRef(module, "DRIVER_USB1", PyLong_FromLongLong(DRIVER_USB1));
346346
result += PyModule_AddObjectRef(module, "DRIVER_USB2", PyLong_FromLongLong(DRIVER_USB2));
347347
result += PyModule_AddObjectRef(module, "DRIVER_USB3", PyLong_FromLongLong(DRIVER_USB3));
348-
result += PyModule_AddObjectRef(module, "SERVD_DRIVER_MASK", PyLong_FromLongLong(SERVD_DRIVER_MASK));
349-
result += PyModule_AddObjectRef(module, "SERVD_DRIVER_VCP", PyLong_FromLongLong(SERVD_DRIVER_VCP));
350-
result += PyModule_AddObjectRef(module, "SERVD_DRIVER_DXX", PyLong_FromLongLong(SERVD_DRIVER_DXX));
351-
result += PyModule_AddObjectRef(module, "SERVD_DRIVER_CAB", PyLong_FromLongLong(SERVD_DRIVER_CAB));
352-
result += PyModule_AddObjectRef(module, "SERVD_DRIVER_TCP", PyLong_FromLongLong(SERVD_DRIVER_TCP));
353348
// enum
354349
result += PyModule_AddObjectRef(module, "PHY_88Q211x_Z1", PyLong_FromLongLong(PHY_88Q211x_Z1));
355350
result += PyModule_AddObjectRef(module, "PHY_88Q211x_A0", PyLong_FromLongLong(PHY_88Q211x_A0));
@@ -625,6 +620,7 @@ int setup_module_auto_defines(PyObject * module)
625620
// end of enum - } ExtendedResponseCode;
626621

627622
result += PyModule_AddObjectRef(module, "GENERIC_API_DATA_BUFFER_SIZE", PyLong_FromUnsignedLongLong(GENERIC_API_DATA_BUFFER_SIZE));
623+
result += PyModule_AddObjectRef(module, "UART_DATA_BUFFER_SIZE", PyLong_FromUnsignedLongLong(UART_DATA_BUFFER_SIZE));
628624
result += PyModule_AddObjectRef(module, "MACADDR_LEN", PyLong_FromUnsignedLongLong(MACADDR_LEN));
629625
result += PyModule_AddObjectRef(module, "MULTI_MACADDR_CNT", PyLong_FromUnsignedLongLong(MULTI_MACADDR_CNT));
630626
result += PyModule_AddObjectRef(module, "GENERIC_BINARY_STATUS_ERROR_UNKNOWN_BINARY", PyLong_FromLongLong(GENERIC_BINARY_STATUS_ERROR_UNKNOWN_BINARY));
@@ -1145,9 +1141,6 @@ int setup_module_auto_defines(PyObject * module)
11451141
// end of enum - } epsilon10GPHYFW;
11461142

11471143
result += PyModule_AddObjectRef(module, "NUM_DEVICE_FEATURE_BITFIELDS", PyLong_FromLongLong(NUM_DEVICE_FEATURE_BITFIELDS));
1148-
// enum
1149-
// end of enum - }
1150-
11511144
result += PyModule_AddObjectRef(module, "CICSSPYSTATUSBITS_H_", PyLong_FromUnsignedLongLong(CICSSPYSTATUSBITS_H_));
11521145
result += PyModule_AddObjectRef(module, "SPY_STATUS_GLOBAL_ERR", PyLong_FromLongLong(SPY_STATUS_GLOBAL_ERR));
11531146
result += PyModule_AddObjectRef(module, "SPY_STATUS_TX_MSG", PyLong_FromLongLong(SPY_STATUS_TX_MSG));

0 commit comments

Comments
 (0)