Skip to content

Commit cfbcd63

Browse files
cebarksclaude
andcommitted
Merge branch 'master' into duplicate-fix
Resolved merge conflicts between parallel development branches: - Merged lib_path and _libs parameter implementations for custom library paths - Deduplicated Workshop GetAppDependencies methods - Added new Workshop API methods (UGC query, download callbacks) - Preserved SWPY_PATH env var support from master - Maintained backward compatibility with both lib_path and _libs parameters Priority order for library search: 1. lib_path (if provided) 2. _libs (if provided) 3. SWPY_PATH env var 4. Current directory 5. Package directory 6. Nuitka fallback 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2 parents 6111871 + 7b35e08 commit cfbcd63

File tree

6 files changed

+57
-58
lines changed

6 files changed

+57
-58
lines changed

library/SteamworksPy.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
#include <iostream>
2424
#include <string>
25+
#include <cstdint>
2526

2627
//-----------------------------------------------
2728
// Definitions

library/sdk/redist/.gitignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

steamworks/__init__.py

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,21 @@ class STEAMWORKS(object):
4444
:param lib_path: Optional path to directory containing Steamworks libraries
4545
(libsteam_api.so/dylib/dll and SteamworksPy.so/dylib/dll)
4646
If not provided, searches current directory, package directory, and Nuitka fallback
47+
:param _libs: Alternative parameter for library path (deprecated, use lib_path instead)
48+
Kept for backward compatibility
4749
"""
4850
_arch = steamworks_util.get_arch()
4951
_native_supported_platforms = ['linux', 'linux2', 'darwin', 'win32']
5052

5153
def __init__(
5254
self,
5355
supported_platforms: list = [],
54-
lib_path: str | Path | None = None
56+
lib_path: str | Path | None = None,
57+
_libs=None
5558
) -> None:
5659
self._supported_platforms = supported_platforms
5760
self._lib_path = lib_path
61+
self._libs = _libs
5862
self._loaded = False
5963
self._cdll = None
6064

@@ -72,9 +76,11 @@ def _get_library_search_paths(self) -> list[str]:
7276
7377
Priority order:
7478
1. Custom lib_path (if provided)
75-
2. Current working directory
76-
3. Package directory
77-
4. Nuitka fallback (2 dirs up from __file__)
79+
2. Custom _libs (if provided)
80+
3. SWPY_PATH env var (if set)
81+
4. Current working directory
82+
5. Package directory
83+
6. Nuitka fallback (2 dirs up from __file__)
7884
7985
:return: List of directory paths to search
8086
"""
@@ -85,13 +91,21 @@ def _get_library_search_paths(self) -> list[str]:
8591
resolved_path = str(Path(self._lib_path).resolve())
8692
paths.append(resolved_path)
8793

88-
# Priority 2: Current working directory
94+
# Priority 2: Custom _libs if provided (backward compatibility)
95+
if self._libs is not None:
96+
paths.append(self._libs)
97+
98+
# Priority 3: SWPY_PATH environment variable
99+
if os.environ.get('SWPY_PATH'):
100+
paths.append(os.environ['SWPY_PATH'])
101+
102+
# Priority 4: Current working directory
89103
paths.append(os.getcwd())
90104

91-
# Priority 3: Package directory
105+
# Priority 5: Package directory
92106
paths.append(os.path.dirname(__file__))
93107

94-
# Priority 4: Nuitka fallback (2 dirs up)
108+
# Priority 6: Nuitka fallback (2 dirs up)
95109
if is_nuitka:
96110
nuitka_path = os.path.split(os.path.split(__file__)[0])[0]
97111
paths.append(nuitka_path)
@@ -117,12 +131,18 @@ def _setup_library_path(self) -> None:
117131
Configure LD_LIBRARY_PATH environment variable for library loading.
118132
Only needed on Linux/macOS.
119133
"""
120-
# Build path list (custom path gets priority)
134+
# Build path list (custom paths get priority)
121135
paths_to_add = []
122136

123137
if self._lib_path is not None:
124138
paths_to_add.append(str(Path(self._lib_path).resolve()))
125139

140+
if self._libs is not None:
141+
paths_to_add.append(self._libs)
142+
143+
if os.environ.get('SWPY_PATH'):
144+
paths_to_add.append(os.environ['SWPY_PATH'])
145+
126146
paths_to_add.append(os.getcwd())
127147

128148
# Preserve existing LD_LIBRARY_PATH

steamworks/interfaces/workshop.py

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class SteamWorkshop(object):
1515
_RemoteStorageSubscribePublishedFileResult_t = CFUNCTYPE(None, SubscriptionResult)
1616
_RemoteStorageUnsubscribePublishedFileResult_t = CFUNCTYPE(None, SubscriptionResult)
1717
_SteamUGCQueryCompleted_t = CFUNCTYPE(None, SteamUGCQueryCompleted_t)
18-
_GetAppDependenciesResult_t = CFUNCTYPE(None, GetAppDependenciesResult_t)
18+
_GetAppDependenciesCallback_t = CFUNCTYPE(None, GetAppDependenciesResult_t)
1919
_DownloadItemResult_t = CFUNCTYPE(None, DownloadItemResult_t)
2020

2121
_CreateItemResult = None
@@ -25,7 +25,7 @@ class SteamWorkshop(object):
2525
_RemoteStorageSubscribePublishedFileResult = None
2626
_RemoteStorageUnsubscribePublishedFileResult = None
2727
_SteamUGCQueryCompleted = None
28-
_GetAppDependenciesResult = None
28+
_GetAppDependenciesCallback = None
2929
_DownloadItemResult = None
3030

3131

@@ -479,36 +479,11 @@ def SetGetAppDependenciesCallback(self, callback: object) -> bool:
479479
:param callback: callable
480480
:return: bool
481481
"""
482-
self._GetAppDependenciesResult = self._GetAppDependenciesResult_t(callback)
483-
self.steam.Workshop_SetGetAppDependenciesCallback(self._GetAppDependenciesResult)
482+
self._GetAppDependenciesCallback = self._GetAppDependenciesCallback_t(callback)
483+
self.steam.Workshop_SetGetAppDependenciesCallback(self._GetAppDependenciesCallback)
484484
return True
485485

486486

487-
def GetAppDependencies(self, published_file_id: int, callback: object = None,
488-
override_callback: bool = False) -> None:
489-
"""Get app dependencies for a workshop item
490-
491-
Returns a list of app IDs that the workshop item depends on.
492-
These are "soft" dependencies shown on the Steam Workshop web page.
493-
The callback may be called multiple times if there are more than 32 dependencies.
494-
495-
:param published_file_id: int
496-
:param callback: callable - receives GetAppDependenciesResult_t
497-
:param override_callback: bool
498-
:return: None
499-
"""
500-
if override_callback:
501-
self.SetGetAppDependenciesCallback(callback)
502-
503-
elif callback and not self._GetAppDependenciesResult:
504-
self.SetGetAppDependenciesCallback(callback)
505-
506-
if self._GetAppDependenciesResult is None:
507-
raise SetupRequired('Call `SetGetAppDependenciesCallback` first or supply a `callback`')
508-
509-
self.steam.Workshop_GetAppDependencies(published_file_id)
510-
511-
512487
def DownloadItem(self, published_file_id: int, high_priority: bool = False,
513488
callback: object = None, override_callback: bool = False) -> bool:
514489
"""Initiate or prioritize download of a workshop item

steamworks/methods.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,10 +492,6 @@ class InputDigitalActionData_t(Structure):
492492
'restype': None,
493493
'argtypes': [MAKE_CALLBACK(None, structs.GetAppDependenciesResult_t)]
494494
},
495-
'Workshop_GetAppDependencies': {
496-
'restype': None,
497-
'argtypes': [c_uint64]
498-
},
499495
'Workshop_SetDownloadItemCallback': {
500496
'restype': None,
501497
'argtypes': [MAKE_CALLBACK(None, structs.DownloadItemResult_t)]

steamworks/structs.py

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,48 @@
22

33

44
class FindLeaderboardResult_t(Structure):
5-
""" Represents the STEAMWORKS LeaderboardFindResult_t call result type """
6-
_fields_ = [
7-
("leaderboardHandle", c_uint64),
8-
("leaderboardFound", c_uint32)
9-
]
5+
"""Represents the STEAMWORKS LeaderboardFindResult_t call result type"""
6+
7+
_fields_ = [("leaderboardHandle", c_uint64), ("leaderboardFound", c_uint32)]
108

119

1210
class CreateItemResult_t(Structure):
1311
_fields_ = [
1412
("result", c_int),
1513
("publishedFileId", c_uint64),
16-
("userNeedsToAcceptWorkshopLegalAgreement", c_bool)
14+
("userNeedsToAcceptWorkshopLegalAgreement", c_bool),
1715
]
1816

1917

2018
class SubmitItemUpdateResult_t(Structure):
2119
_fields_ = [
2220
("result", c_int),
2321
("userNeedsToAcceptWorkshopLegalAgreement", c_bool),
24-
("publishedFileId", c_uint64)
22+
("publishedFileId", c_uint64),
2523
]
2624

2725

2826
class ItemInstalled_t(Structure):
27+
_fields_ = [("appId", c_uint32), ("publishedFileId", c_uint64)]
28+
29+
30+
class GetAppDependenciesResult(Structure):
2931
_fields_ = [
30-
("appId", c_uint32),
31-
("publishedFileId", c_uint64)
32+
("result", c_int32),
33+
("publishedFileId", c_uint64),
34+
("array_app_dependencies", POINTER(c_int32)),
35+
("array_num_app_dependencies", c_int32),
36+
("total_num_app_dependencies", c_int32),
3237
]
3338

39+
def get_app_dependencies_list(self) -> list:
40+
dependencies_list = []
41+
array_size = self.array_num_app_dependencies
42+
array_type = c_uint32 * array_size
43+
array = array_type.from_address(addressof(self.array_app_dependencies.contents))
44+
dependencies_list.extend(array)
45+
return dependencies_list
46+
3447

3548
class GetAppDependenciesResult(Structure):
3649
_fields_ = [
@@ -51,10 +64,8 @@ def get_app_dependencies_list(self) -> list:
5164

5265

5366
class SubscriptionResult(Structure):
54-
_fields_ = [
55-
("result", c_int32),
56-
("publishedFileId", c_uint64)
57-
]
67+
_fields_ = [("result", c_int32), ("publishedFileId", c_uint64)]
68+
5869

5970

6071
class SteamUGCQueryCompleted_t(Structure):

0 commit comments

Comments
 (0)