Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit 6f91194

Browse files
Reworded the file names
Cuz bin is for binary files, and dist is to distribute said files lmaoo
1 parent 3dd5d1f commit 6f91194

3 files changed

Lines changed: 36 additions & 36 deletions

File tree

pyCTools/_loadDLL.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
def load_dll(
88
dll_prefix_name: str,
99
dll_load_func: Callable = ctypes.WinDLL,
10-
possible_dist_paths: Optional[List[str]] = None,
10+
possible_bin_paths: Optional[List[str]] = None,
1111
hardcoded_dll_location: Optional[str] = None
1212
):
1313
"""
@@ -29,7 +29,7 @@ def load_dll(
2929
The function used to load the DLL, typically `ctypes.WinDLL` or `ctypes.CDLL`.
3030
Defaults to `ctypes.WinDLL`.
3131
32-
possible_dist_paths (Optional[List[str]], optional):
32+
possible_bin_paths (Optional[List[str]], optional):
3333
A list of possible relative paths where the DLL might reside. These are
3434
joined with the DLL filename and searched in order.
3535
Defaults to None, which triggers searching in default distribution directories.
@@ -55,7 +55,7 @@ def load_dll(
5555
"""
5656

5757
# Validate mutually exclusive parameters
58-
if hardcoded_dll_location and possible_dist_paths:
58+
if hardcoded_dll_location and possible_bin_paths:
5959
raise ValueError("Cannot provide both hardcoded_dll_location and possible_dist_paths.")
6060

6161
# Determine system architecture to pick the correct DLL version
@@ -74,16 +74,16 @@ def load_dll(
7474
raise FileNotFoundError(f"Hardcoded DLL location does not exist: {dll_path}")
7575
else:
7676
# If no hardcoded path, define default search paths if not provided
77-
if possible_dist_paths is None:
77+
if possible_bin_paths is None:
7878
# Common fallback directories where DLL might be located relative to this file
79-
possible_dist_paths = [
80-
os.path.join(base_dir, 'dist', arch, dll_name),
81-
os.path.join(base_dir, '..', 'dist', arch, dll_name),
82-
os.path.join(base_dir, '..', '..', 'dist', arch, dll_name),
79+
possible_bin_paths = [
80+
os.path.join(base_dir, 'bin', arch, dll_name),
81+
os.path.join(base_dir, '..', 'bin', arch, dll_name),
82+
os.path.join(base_dir, '..', '..', 'bin', arch, dll_name),
8383
]
8484

8585
# Convert all candidate paths to absolute paths
86-
abs_paths = [os.path.abspath(p) for p in possible_dist_paths]
86+
abs_paths = [os.path.abspath(p) for p in possible_bin_paths]
8787

8888
# Find the first path where the DLL file actually exists
8989
dll_path = next((p for p in abs_paths if os.path.isfile(p)), None)

tool/compilerHelper.ps1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,13 @@ if ($filesToCompile.Count -eq 0) {
3939
exit 1
4040
}
4141

42-
# --- CLEANUP: Remove .obj/.dll/.lib/.exp in root and move all outputs to dist/arch ---
43-
$distRoot = "..\dist"
44-
$x64Folder = Join-Path $distRoot "x64"
45-
$x86Folder = Join-Path $distRoot "x86"
42+
# --- CLEANUP: Remove .obj/.dll/.lib/.exp in root and move all outputs to bin/{arch} ---
43+
$binRoot = "..\bin"
44+
$x64Folder = Join-Path $binRoot "x64"
45+
$x86Folder = Join-Path $binRoot "x86"
4646

4747
# Create output folders
48-
foreach ($folder in @($distRoot, $x64Folder, $x86Folder)) {
48+
foreach ($folder in @($binRoot, $x64Folder, $x86Folder)) {
4949
if (-not (Test-Path $folder)) {
5050
New-Item -ItemType Directory -Path $folder | Out-Null
5151
Write-Host "Created folder: $folder"
@@ -55,7 +55,7 @@ foreach ($folder in @($distRoot, $x64Folder, $x86Folder)) {
5555
}
5656
}
5757

58-
# Remove build artifacts from root (not in dist)
58+
# Remove build artifacts from root (not in bin)
5959
$extensionsToClean = @("*.obj", "*.dll", "*.lib", "*.exp")
6060
foreach ($ext in $extensionsToClean) {
6161
Get-ChildItem -Path . -Filter $ext -File | Remove-Item -Force -ErrorAction SilentlyContinue
@@ -168,7 +168,7 @@ exit /b %errorlevel%
168168
return $true
169169
}
170170

171-
# Compile each file as its own DLL for x64 and x86, outputs in dist/x64 and dist/x86
171+
# Compile each file as its own DLL for x64 and x86, outputs in bin/x64 and bin/x86
172172
foreach ($file in $filesToCompile) {
173173
if (-not (CompileDll -Arch "x64" -OutFolder $x64Folder -File $file)) {
174174
Write-CustomError "x64 build failed for $file."

tool/distributionHelper.ps1

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ try {
1515
# Move one directory up
1616
Set-Location ..
1717

18-
$distPath = Join-Path (Get-Location) "dist"
18+
$binPath = Join-Path (Get-Location) "bin"
1919

20-
if (-not (Test-Path $distPath -PathType Container)) {
21-
$distPath = Read-Host "dist folder not found. Please enter the full path to the dist folder"
22-
if (-not (Test-Path $distPath -PathType Container)) {
23-
Write-CustomError "Provided dist path does not exist or is not a directory."
20+
if (-not (Test-Path $binPath -PathType Container)) {
21+
$binPath = Read-Host "bin folder not found. [Have you executed 'compilerHelper.ps1'?] => Please enter the full path to the bin folder"
22+
if (-not (Test-Path $binPath -PathType Container)) {
23+
Write-CustomError "Provided bin path does not exist or is not a directory."
2424
exit 1
2525
}
2626
}
2727

28-
# Validate dist structure
29-
$x64Path = Join-Path $distPath "x64"
30-
$x86Path = Join-Path $distPath "x86"
28+
# Validate bin structure
29+
$x64Path = Join-Path $binPath "x64"
30+
$x86Path = Join-Path $binPath "x86"
3131

3232
if (-not (Test-Path $x64Path -PathType Container)) {
33-
Write-CustomError "x64 folder is missing inside dist."
33+
Write-CustomError "x64 folder is missing inside bin."
3434
exit 1
3535
}
3636
if (-not (Test-Path $x86Path -PathType Container)) {
37-
Write-CustomError "x86 folder is missing inside dist."
37+
Write-CustomError "x86 folder is missing inside bin."
3838
exit 1
3939
}
4040

@@ -86,23 +86,23 @@ try {
8686
}
8787
}
8888

89-
Write-Host "dist folder validated successfully."
89+
Write-Host "bin folder validated successfully."
9090

91-
# Create bin folder if not exists
92-
$binPath = Join-Path (Split-Path $distPath -Parent) "bin"
93-
if (-not (Test-Path $binPath)) {
94-
New-Item -Path $binPath -ItemType Directory -ErrorAction Stop | Out-Null
95-
Write-Host "Created bin folder at $binPath"
91+
# Create dist folder if not exists
92+
$distPath = Join-Path (Split-Path $binPath -Parent) "dist"
93+
if (-not (Test-Path $distPath)) {
94+
New-Item -Path $distPath -ItemType Directory -ErrorAction Stop | Out-Null
95+
Write-Host "Created dist folder at $distPath"
9696
} else {
97-
Write-Host "bin folder already exists at $binPath"
97+
Write-Host "dist folder already exists at $distPath"
9898
}
9999

100-
# Compress dist folder to ZIP
101-
$zipFile = Join-Path $binPath "dist.zip"
100+
# Compress bin folder to ZIP
101+
$zipFile = Join-Path $distPath "bin.zip"
102102

103103
if (Test-Path $zipFile) { Remove-Item $zipFile -Force }
104104
try {
105-
Compress-Archive -Path (Join-Path $distPath '*') -DestinationPath $zipFile -Force
105+
Compress-Archive -Path (Join-Path $binPath '*') -DestinationPath $zipFile -Force
106106
Write-Host "ZIP archive created at $zipFile"
107107
}
108108
catch {

0 commit comments

Comments
 (0)