Menu

[025cc2]: / Final / DirectPython11.iss  Maximize  Restore  History

Download this file

159 lines (105 with data), 4.9 kB

#define SAMPLES "..\Samples"
#define MODULES "..\Modules"
#define DPNAME "DirectPython 11"
#define DPVER "0.2.0"

[Setup]
AppId={#DPNAME}-{#DPVER}-{#PYVER}-appidstr
AppName={#DPNAME}
AppVerName={#DPNAME} {#DPVER}
AppCopyright=Copyright © 2010 Heikki Salo
DefaultGroupName={#DPNAME} ({#DPVER} - Py {#PYVER})
DefaultDirName={code:FindPython}\Lib\site-packages\directpy11
DisableReadyMemo=yes
;DisableProgramGroupPage=yes
OutputBaseFilename=directpython11-{#DPVER}-py{#PYVER}-x86-setup
SetupIconFile=Setup.ico
WizardImageFile=intro.bmp
LicenseFile=license.txt
AllowNoIcons=yes
;For the .exe itself
VersionInfoVersion={#DPVER}
PrivilegesRequired=admin
;SolidCompression=yes
;ChangesAssociations=yes
AppComments=Direct3D 11 for Python {#PYVER}
AppVersion={#DPVER}

[Icons]
Name: {group}\View Samples; Filename: {app}\Samples; WorkingDir: {app}\Samples; Flags: foldershortcut
Name: {group}\Documentation; Filename: {app}\Docs\index.html
Name: {group}\Home Page; Filename: http://directpython11.sourceforge.net/
Name: {group}\Uninstall; Filename: {uninstallexe}
Name: {group}\Sample Browser; Filename: {code:FindPython}\pythonw.exe; Parameters: """{app}\samples\SampleBrowser.py"""; WorkingDir: {app}\samples; IconFilename: {app}\samples\textures\x.ico

[Files]
;Main modules
Source: ..\Release {#PYVER}\d3d11.pyd; DestDir: {app}
Source: {#MODULES}\d3d11x.py; DestDir: {app}
Source: {#MODULES}\d3d11c.py; DestDir: {app}
Source: {#MODULES}\d3d11gui.py; DestDir: {app}
Source: {#MODULES}\dds.py; DestDir: {app}

;C and C++ runtime
Source: D:\Ohjelmointi\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT\msvcr100.dll; DestDir: {app}
Source: D:\Ohjelmointi\Microsoft Visual Studio 10.0\VC\redist\x86\Microsoft.VC100.CRT\msvcp100.dll; DestDir: {app}

;Boost.Python
Source: ..\Release {#PYVER}\boost_python-vc100-mt-1_43.dll; DestDir: {app}

;License and .pth (assumes that installed to site-packages...)
Source: license.txt; DestDir: {app}
Source: directpy11.pth; DestDir: {app}\..; AfterInstall: WritePTH

;Everything under samples, exclude some stuff.
Source: {#SAMPLES}\*.*; DestDir: {app}\Samples; Excludes: "*.bat,\Junk\*,memoryleak*,start*,*.pyc"; Flags: recursesubdirs

;Tests
Source: ..\Tests\*.*; DestDir: {app}\Tests; Excludes: "*.pyc,*.log"; Flags: recursesubdirs

;Documentation
Source: ..\Docs\docbuild\*.*; DestDir: {app}\Docs; Excludes: "\.doctrees\*,\_sources\*"; Flags: recursesubdirs

;Misc stuff
Source: ..\Misc\*.*; DestDir: {app}\Misc;

;D3D Redist and install helpers
Source: Redist\*.*; DestDir: {app}\Redist

[Run]
Filename: {app}\Redist\DXSETUP.exe; Parameters: "/silent"; StatusMsg: "Updating Direct3D..."; Flags: runascurrentuser
Filename: {app}\Redist\D3D11Install.exe; Description: Check Direct3D 11 support; Flags: postinstall runascurrentuser nowait skipifsilent
Filename: {code:FindPython}\pythonw.exe; Parameters: "-c ""import compileall; compileall.compile_dir(r'{app}', 0)"""; StatusMsg: Compiling .py files...; Flags: skipifdoesntexist

[UninstallDelete]
Name: {app}\*.pyc; Type: files
Name: {app}\__pycache__; Type: filesandordirs

Name: {app}\Samples\*.pyc; Type: files
Name: {app}\Samples\__pycache__; Type: filesandordirs

Name: {app}\Tests\*.pyc; Type: files
Name: {app}\Tests\__pycache__; Type: filesandordirs

[Code]

function InitializeSetup: Boolean;
var
  version: TWindowsVersion;
  ask : Boolean;
begin
  GetWindowsVersionEx(version);
  Result := True;
  ask := False;

  //Older than Vista?
  if version.Major < 6 then
    ask := True;

  //Vista, but not SP 2?
  if (version.Major = 6) and (version.Minor = 0) and (version.ServicePackMajor < 2) then
    ask := True;

  if ask then
    Result := MsgBox('DirectPython requires at least Windows Vista Service Pack 2 (with Platform Update). Do you want to continue?', mbConfirmation, MB_YESNO) = IDYES;
end;

//Only complain once if the registry key is not found.
var HasBeenNoted: Boolean;

function FindPython(Default : String) : String;
var
  ok: Boolean;
begin
  Result := ExpandConstant('{sd}\YOUR_PYTHON_DIR');
  ok := RegQueryStringValue(HKCU, 'SOFTWARE\Python\PythonCore\{#PYVER}\InstallPath', '', Result);
  if not ok then
    ok := RegQueryStringValue(HKLM, 'SOFTWARE\Python\PythonCore\{#PYVER}\InstallPath', '', Result);

  if not ok and not HasBeenNoted then begin
    MsgBox('Python''s installation directory not found from the registry. Please install DirectPython to "PYTHONDIR\Lib\site-packages\directpy11" or to another place where it can be imported by Python.', mbInformation, MB_OK);
    HasBeenNoted := true;
  end
end;

//.pth for site.py
procedure WritePTH();
begin
  SaveStringToFile(ExpandConstant('{app}\..\directpy11.pth'), ExtractFileName(ExpandConstant('{app}')), False);
end;




























Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.