Skip to content

Commit

Permalink
GH-19: Replaced _acquire_pluginapi.bat with _get_nsis_sdk.py
Browse files Browse the repository at this point in the history
  • Loading branch information
negrutiu committed Jun 1, 2024
1 parent 1e89c4c commit 6216faa
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 30 deletions.
4 changes: 2 additions & 2 deletions src/nscurl/Makefile.windows
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ RCFLAGS += \
$(CUSTOM_RCFLAGS)


.PHONY: clean all-before all all-after nsis-sdk curl-ca-bundle vcpkg-install
.PHONY: clean all-before all all-after nsis-sdk curl-ca-bundle update-file-version vcpkg-install

clean:
@echo.
Expand All @@ -133,7 +133,7 @@ all-before:

nsis-sdk:
REM ----- NSIS SDK ------------------------------------------------------------
call _acquire_pluginapi.bat
call py -3 _get_nsis_sdk.py

curl-ca-bundle:
REM ----- curl-ca-bundle.crt --------------------------------------------------
Expand Down
8 changes: 4 additions & 4 deletions src/nscurl/NScurl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
<AdditionalDependencies>version.lib;libcurl-d.lib;libcrypto.lib;libssl.lib;nghttp2.lib;zlibd.lib;zstd.lib;brotlicommon.lib;brotlidec.lib;ws2_32.lib;Wldap32.lib;Crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>call _acquire_pluginapi.bat &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
<Command>call py -3 _get_nsis_sdk.py &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand All @@ -105,7 +105,7 @@
<AdditionalDependencies>version.lib;libcurl-d.lib;libcrypto.lib;libssl.lib;nghttp2.lib;zlibd.lib;zstd.lib;brotlicommon.lib;brotlidec.lib;ws2_32.lib;Wldap32.lib;Crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>call _acquire_pluginapi.bat &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
<Command>call py -3 _get_nsis_sdk.py &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand All @@ -125,7 +125,7 @@
<AdditionalDependencies>version.lib;libcurl.lib;libcrypto.lib;libssl.lib;nghttp2.lib;zlib.lib;zstd.lib;brotlicommon.lib;brotlidec.lib;ws2_32.lib;Wldap32.lib;Crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>call _acquire_pluginapi.bat &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
<Command>call py -3 _get_nsis_sdk.py &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand All @@ -144,7 +144,7 @@
<AdditionalDependencies>version.lib;libcurl.lib;libcrypto.lib;libssl.lib;nghttp2.lib;zlib.lib;zstd.lib;brotlicommon.lib;brotlidec.lib;ws2_32.lib;Wldap32.lib;Crypt32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<PreBuildEvent>
<Command>call _acquire_pluginapi.bat &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
<Command>call py -3 _get_nsis_sdk.py &amp;&amp; call _acquire_curl-ca-bundle.bat &amp;&amp; call py -3 _update_resource_version.py &amp;&amp; call "$(SolutionDir)_install_vcpkg.bat" $(Platform) msbuild static
</Command>
</PreBuildEvent>
</ItemDefinitionGroup>
Expand Down
24 changes: 0 additions & 24 deletions src/nscurl/_acquire_pluginapi.bat

This file was deleted.

28 changes: 28 additions & 0 deletions src/nscurl/_get_nsis_sdk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Download NSIS SDK files from GitHub

from pathlib import Path
from urllib import request

cd = Path(__file__).parent
files = {
cd.joinpath('nsis', 'api.h') : "https://raw.githubusercontent.com/kichik/nsis/master/Source/exehead/api.h",
cd.joinpath('nsis', 'nsis_tchar.h') : "https://raw.githubusercontent.com/kichik/nsis/master/Contrib/ExDLL/nsis_tchar.h",
cd.joinpath('nsis', 'pluginapi.c') : "https://raw.githubusercontent.com/kichik/nsis/master/Contrib/ExDLL/pluginapi.c",
cd.joinpath('nsis', 'pluginapi.h') : "https://raw.githubusercontent.com/kichik/nsis/master/Contrib/ExDLL/pluginapi.h",
}

download = False
for file in files:
if not file.exists(): download = True

if download:
print("Downloading NSIS SDK ...")
for file, url in files.items():
print(file.name)
with request.urlopen(url) as http:
file.parent.mkdir(parents=True, exist_ok=True)
with open(file, 'wb') as outfile:
outfile.write(http.read())
print(f" {http.status} {http.reason}, {http.getheader('Content-Length')} bytes")
else:
print("Use existing NSIS SDK ...")

0 comments on commit 6216faa

Please sign in to comment.