Skip to content

Commit 0a1d660

Browse files
committed
Fix example scripts issue
1 parent 462735a commit 0a1d660

File tree

8 files changed

+37
-19
lines changed

8 files changed

+37
-19
lines changed

src/examples/build-for-exe.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ cd /D %PROJECT%
9494

9595
REM This is the key, change default runtime path, otherwise dynamic library _pytransform could not be found
9696
Echo.
97-
Call pyarmor.bat config --runtime-path="" --manifest "global-include *.py, exclude %ENTRY_SCRIPT% setup.py pytransform.py, prune build, prune dist"
97+
Call pyarmor.bat config --runtime-path="" --package-runtime=0 --manifest "global-include *.py, exclude %ENTRY_SCRIPT% setup.py pytransform.py, prune build, prune dist"
9898

9999
REM Obfuscate scripts without runtime files, only obfuscated scripts are generated
100100
Echo.

src/examples/build-for-freeze.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ cd /D %PROJECT%
9393

9494
REM This is the key, change default runtime path, otherwise dynamic library _pytransform could not be found
9595
Echo.
96-
Call pyarmor.bat config --runtime-path="" --manifest "global-include *.py, exclude %ENTRY_SCRIPT% setup.py pytransform.py, prune build, prune dist"
96+
Call pyarmor.bat config --runtime-path="" --package-runtime=0 --manifest "global-include *.py, exclude %ENTRY_SCRIPT% setup.py pytransform.py, prune build, prune dist"
9797

9898
REM Obfuscate scripts without runtime files, only obfuscated scripts are generated
9999
Echo.

src/examples/build-with-project.bat

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -100,13 +100,14 @@ IF DEFINED LICENSE_CODE (
100100

101101
REM Overwrite default license with this license
102102
ECHO.
103-
IF DEFINED PKGNAME (
104-
ECHO Copy new license to %PROJECT%\dist
105-
COPY licenses\%LICENSE_CODE%\license.lic %PROJECT%\dist
103+
IF DEFINED PKGNAME (
104+
SET LICPATH=%PROJECT%\dist
106105
) ELSE (
107-
ECHO Copy new license to %PROJECT%\dist\%PKGNAME%
108-
COPY licenses\%LICENSE_CODE%\license.lic %PROJECT%\dist\%PKGNAME%
106+
SET LICPATH=%PROJECT%\dist\%PKGNAME%
109107
)
108+
IF NOT EXIST "%LICPATH%\license.lic" SET LICPATH=%LICPATH%\pytransform
109+
ECHO Copy new license to %LICPATH%
110+
COPY licenses\%LICENSE_CODE%\license.lic %LICPATH%
110111
ECHO.
111112

112113
)

src/examples/build-with-project.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,15 @@ if [[ -n "${LICENSE_CODE}" ]] ; then
7272

7373
# Overwrite default license with this license
7474
if [[ -n "${PKGNAME}" ]] ; then
75-
echo Copy new license to $PROJECT/dist
76-
cp licenses/${LICENSE_CODE}/license.lic $PROJECT/dist/${PKGNAME}
75+
LICPATH=$PROJECT/dist/${PKGNAME}
7776
else
78-
echo Copy new license to $PROJECT/dist/${PKGNAME}
79-
cp licenses/${LICENSE_CODE}/license.lic $PROJECT/dist
77+
LICPATH=$PROJECT/dist
8078
fi
79+
if ! [[ -f "$LICPATH/license.lic" ]] ; then
80+
LICPATH=$LICPATH/pytransform
81+
fi
82+
echo Copy new license to $PROJECT/dist/${PKGNAME}
83+
cp licenses/${LICENSE_CODE}/license.lic $PROJECT/dist
8184
fi
8285

8386
# Run obfuscated scripts if

src/examples/obfuscate-app.bat

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ IF DEFINED LICENSE_EXPIRED_DATE (
4747

4848
REM Overwrite default license with this expired license
4949
ECHO.
50-
ECHO Copy expired license to %OUTPUT%
51-
COPY licenses\%LICENSE_CODE%\license.lic %OUTPUT%
50+
SET LICPATH=%OUTPUT%
51+
IF NOT EXIST "%LICPATH%\license.lic" SET LICPATH=%LICPATH%\pytransform
52+
ECHO Copy new license to %LICPATH%
53+
COPY licenses\%LICENSE_CODE%\license.lic %LICPATH%
5254
ECHO.
5355
)
5456

src/examples/obfuscate-app.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,13 @@ if [[ -n "${LICENSE_EXPIRED_DATE}" ]] ; then
3333
echo
3434

3535
# Overwrite default license with this expired license
36-
echo Copy expired license to $OUTPUT
37-
cp licenses/${LICENSE_CODE}/license.lic $OUTPUT
36+
if [[ -f "$OUTPUT/license.lic" ]] ; then
37+
echo Copy expired license to $OUTPUT
38+
cp licenses/${LICENSE_CODE}/license.lic $OUTPUT
39+
else
40+
echo Copy expired license to $OUTPUT/pytransform
41+
cp licenses/${LICENSE_CODE}/license.lic $OUTPUT/pytransform
42+
fi
3843
fi
3944

4045
# Run obfuscated scripts

src/examples/obfuscate-pkg.bat

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ IF DEFINED LICENSE_EXPIRED_DATE (
5959

6060
REM Overwrite default license with this expired license
6161
ECHO.
62-
ECHO Copy expired license to %OUTPUT%\%PKGNAME%
63-
COPY licenses\%LICENSE_CODE%\license.lic %OUTPUT%\%PKGNAME%
62+
SET LICPATH=%OUTPUT%\%PKGNAME%
63+
IF NOT EXIST "%LICPATH%\license.lic" SET LICPATH=%LICPATH%\pytransform
64+
ECHO Copy new license to %LICPATH%
65+
COPY licenses\%LICENSE_CODE%\license.lic %LICPATH%
6466
ECHO.
6567
)
6668

src/examples/obfuscate-pkg.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,13 @@ if [[ -n "${LICENSE_EXPIRED_DATE}" ]] ; then
4545
echo
4646

4747
# Overwrite default license with this expired license
48-
echo "Copy expired license to ${OUTPUT}/$PKGNAME"
49-
cp licenses/${LICENSE_CODE}/license.lic ${OUTPUT}/$PKGNAME
48+
if [[ -f "$OUTPUT/$PKGNAME/license.lic" ]] ; then
49+
echo Copy expired license to $OUTPUT/$PKGNAME
50+
cp licenses/${LICENSE_CODE}/license.lic $OUTPUT/$PKGNAME
51+
else
52+
echo Copy expired license to $OUTPUT/$PKGNAME/pytransform
53+
cp licenses/${LICENSE_CODE}/license.lic $OUTPUT/$PKGNAME/pytransform
54+
fi
5055
fi
5156

5257
# Run obfuscated scripts if

0 commit comments

Comments
 (0)