Tools for python scripts compilation
Updates build scripts that create python binaries (pyc files) from python scripts using nPython. Also adds *.pyc to gitignore.
This commit is contained in:
@@ -1,23 +1,9 @@
|
||||
REM QuantConnect Lean Engine -- Python Build Script.
|
||||
REM Requires python algorithm to have a "main.py" which is the primary import point.
|
||||
|
||||
REM Set Python Compiler Location
|
||||
SET pyc="C:\Program Files (x86)\IronPython 2.7\Tools\Scripts\pyc.py"
|
||||
SET ipy="C:\Program Files (x86)\IronPython 2.7\ipy.exe"
|
||||
|
||||
REM Clean the output directory
|
||||
del "QuantConnect.Algorithm.Python.dll"
|
||||
del "../../../Launcher/bin/Debug/QuantConnect.Algorithm.Python.dll"
|
||||
del "../../../Tests/bin/Debug/QuantConnect.Algorithm.Python.dll"
|
||||
|
||||
REM Collect the names of all files in current directory
|
||||
setlocal EnableDelayedExpansion EnableExtensions
|
||||
SET pyfiles=
|
||||
for %%f in (..\..\*.py) do SET pyfiles=!pyfiles! %%f
|
||||
|
||||
REM IronPython Compile the Algorithmwith all the files in current directory
|
||||
%ipy% %pyc% /target:dll /out:QuantConnect.Algorithm.Python !pyfiles!
|
||||
REM Python Compile the Algorithm with all the files in current directory
|
||||
nPython -m compileall -lq .
|
||||
|
||||
REM Copy to the Lean Algorithm Project
|
||||
echo f|xcopy /Y "QuantConnect.Algorithm.Python.dll" "../../../Launcher/bin/Debug/QuantConnect.Algorithm.Python.dll"
|
||||
echo f|xcopy /Y "QuantConnect.Algorithm.Python.dll" "../../../Tests/bin/Debug/QuantConnect.Algorithm.Python.dll"
|
||||
copy *.pyc ..\Launcher\bin\Debug >NUL
|
||||
copy *.pyc ..\Launcher\bin\Release >NUL
|
||||
copy *.pyc ..\Tests\bin\Debug >NUL
|
||||
@@ -1,17 +1,6 @@
|
||||
# QuantConnect Lean Algorithmic Trading Engine: Python Builder Script
|
||||
#!/bin/bash
|
||||
mono nPython.exe -m compileall -lq .
|
||||
|
||||
# Clean output directory
|
||||
rm QuantConnect.Algorithm.Python.dll
|
||||
rm ../../../Launcher/bin/Debug/QuantConnect.Algorithm.Python.dll
|
||||
rm ../../../Tests/bin/Debug/QuantConnect.Algorithm.Python.dll
|
||||
|
||||
# Set the script variables: assuming installing the ./compiler/library/ and the caller is in ./compiler/bin/Debug/build.sh
|
||||
ipy="../../IronPython-2.7.5/ipy.exe"
|
||||
pyc="../../IronPython-2.7.5/Tools/Scripts/pyc.py"
|
||||
|
||||
# Call the compiler with all the files in current directory
|
||||
mono $ipy $pyc /target:dll /out:QuantConnect.Algorithm.Python $(ls ../../*.py)
|
||||
|
||||
# Copy to the Lean Algorithm Project
|
||||
cp QuantConnect.Algorithm.Python.dll ../../../Launcher/bin/Debug/QuantConnect.Algorithm.Python.dll
|
||||
cp QuantConnect.Algorithm.Python.dll ../../../Tests/bin/Debug/QuantConnect.Algorithm.Python.dll
|
||||
cp *.pyc ../Launcher/bin/Debug/
|
||||
cp *.pyc ../Launcher/bin/Release/
|
||||
cp *.pyc ../Tests/bin/Debug/
|
||||
|
||||
Reference in New Issue
Block a user