Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
client
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
8a8e82c9
authored
Jun 16, 2015
by
Csók Tamás
2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
client: created a choosable agressive Python search NSIS solution
parent
1eae6d5e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
23 deletions
+61
-23
src/nsi/cloud.nsi
+0
-0
src/nsi/installer/install.cmd
+47
-17
src/nsi/installer/pywin_installer.py
+14
-6
No files found.
src/nsi/cloud.nsi
View file @
8a8e82c9
This diff is collapsed.
Click to expand it.
src/nsi/installer/install.cmd
View file @
8a8e82c9
...
...
@@ -34,7 +34,27 @@ IF NOT "%4"=="" (
SET my_site=!site:"=!
SET "website= -t ^"!my_site!^""
SET "32PythonOn64=False"
rem Set Python version if we know it
IF NOT "%5"=="" (
SET "version=%5"
) else (
SET "version="
)
rem Set Python bit count (32 or 64) if we know it
IF NOT "%6"=="" (
SET "architecture=%6"
) else (
SET "architecture="
)
rem Set Python location if we know it
IF NOT "%7"=="" (
SET "python_location=%7"
SET install_path=!python_location:"=!
) else (
SET "install_path="
)
:BatchCheckElevated
:-------------------------------------
...
...
@@ -53,7 +73,8 @@ if '%errorlevel%' NEQ '0' (
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > ^"%temp%\getadmin.vbs^"
set vbs_site=!site:"=""!
echo UAC.ShellExecute "cmd.exe", "/c %~s0 !output_on_screen! !install_nx! !vbs_site!", "", "runas", 1 >> "%temp%\getadmin.vbs"
set vbs_installpath=!python_location:"=""!
echo UAC.ShellExecute "cmd.exe", "/c %~s0 !install_location! !output_on_screen! !install_nx! !vbs_site! !version! !architecture! !vbs_installpath!", "", "runas", 1 >> "%temp%\getadmin.vbs"
^"%temp%\getadmin.vbs^"
del "%temp%\getadmin.vbs"
...
...
@@ -75,8 +96,16 @@ IF NOT "!output_on_screen!"=="False" (
)
@echo Starting CIRCLE Client install script
@echo.
call :SUB_ARCHITECTURE architecture
IF NOT "!install_path!"=="" (
IF NOT "!output_on_screen!"=="False" (
@echo Python location got from input parameter.>CON
)
@echo Python location got from input parameter.
GOTO HASPYTHON
)
if "!architecture!"=="" (
call :SUB_ARCHITECTURE architecture
)
:PYTHON_CHECK_MODULE
rem Decide whether python 2.x is installed or not
SET "python_registry="
...
...
@@ -88,7 +117,7 @@ SET index=8
if "!architecture!"=="64" (
if "%python_registry%"=="" (
SET "python_registry=Wow6432Node\"
SET "
32PythonOn64=True
"
SET "
architecture=32
"
GOTO PYTHON_CHECK
) else (
GOTO NOPYTHON
...
...
@@ -98,7 +127,7 @@ SET index=8
)
)
SET version=2.%index%
SET @query="hklm\SOFTWARE\%python_registry%Python\PythonCore\
%version%
"
SET @query="hklm\SOFTWARE\%python_registry%Python\PythonCore\
!version!
"
reg>nul query %@query% 2>nul
IF ERRORLEVEL 1 GOTO loop
IF ERRORLEVEL 0 GOTO HASPYTHON
...
...
@@ -116,7 +145,7 @@ IF NOT "!output_on_screen!"=="False" (
@echo 64 bit system detected, commencing the install>CON
)
@echo 64 bit system detected, commencing the install
start "Phyton Installer" /WAIT ^"%running_directory%x64^\python-2.7.
7
.amd64.msi^"
start "Phyton Installer" /WAIT ^"%running_directory%x64^\python-2.7.
10
.amd64.msi^"
GOTO NOWHASPYTHON
)
if "!architecture!"=="32" (
...
...
@@ -124,7 +153,7 @@ IF NOT "!output_on_screen!"=="False" (
@echo 32 bit system detected, commencing the install>CON
)
@echo 32 bit system detected, commencing the install
start "Phyton Installer" /WAIT ^"%running_directory%x86^\python-2.7.
7
.msi^"
start "Phyton Installer" /WAIT ^"%running_directory%x86^\python-2.7.
10
.msi^"
GOTO NOWHASPYTHON
)
GOTO ERR
...
...
@@ -171,20 +200,21 @@ IF NOT "!output_on_screen!"=="False" (
rem We have Python but let's check if it's in the PATH
:HASPYTHON
IF NOT "!output_on_screen!"=="False" (
@echo
%version%
Python is found, checking PATH variable>CON
@echo
!version!
Python is found, checking PATH variable>CON
)
@echo
%version%
Python is found, checking PATH variable
@echo
!version!
Python is found, checking PATH variable
rem Check Python install path
set install_path=
for /f "tokens=2,*" %%a in ('reg query "hklm\SOFTWARE\%python_registry%Python\PythonCore\%version%\InstallPath"') do (
set install_path=%%b
IF "!install_path!"=="" (
for /f "tokens=2,*" %%a in ('reg query "hklm\SOFTWARE\%python_registry%Python\PythonCore\!version!\InstallPath"') do (
set install_path=%%b
)
)
rem Check whether python.exe is in the install path (python uninstall doesn't delete registry entrys)
if NOT EXIST "
%install_path%
python.exe" (
if NOT EXIST "
!install_path!
python.exe" (
IF NOT "!output_on_screen!"=="False" (
@echo
%version%
Python was installed but it is NOT now. Restarting the search for python^^!>CON
@echo
!version!
Python was installed but it is NOT now. Restarting the search for python^^!>CON
)
@echo
%version%
Python was installed but it is NOT now. Restarting the search for python^^!
@echo
!version!
Python was installed but it is NOT now. Restarting the search for python^^!
goto loop
) else (
set test=%install_path:~0,-1%
...
...
@@ -247,7 +277,7 @@ IF NOT "!output_on_screen!"=="False" (
rem Try to install the PIP packages via PIP
:PIP_PACKAGE_INSTALL
if "!pip_program!"=="pywin32" (
call python
%running_directory%pywin_installer.py
call python
^"%running_directory%pywin_installer.py^" ^-m !architecture!
) else (
call python -m pip install -r !pip_program!
)
...
...
src/nsi/installer/pywin_installer.py
View file @
8a8e82c9
...
...
@@ -11,6 +11,11 @@ import subprocess
import
windowsclasses
import
argparse
if
windowsclasses
.
DecideArchitecture
.
Is64Windows
():
default_mode
=
'64'
else
:
default_mode
=
'32'
def
parse_arguments
():
"""
...
...
@@ -21,10 +26,9 @@ def parse_arguments():
"""
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
"change_architect"
,
type
=
str
,
help
=
(
"Whether the 32 bit Python version"
"is installed on a 64bit system"
),
nargs
=
'?'
,
default
=
False
)
"-m"
,
"--mode"
,
help
=
"Python running mode (32bit or 64bit)"
,
type
=
str
,
required
=
True
,
choices
=
[
'32'
,
'64'
],
default
=
default_mode
)
args
=
parser
.
parse_args
()
return
args
...
...
@@ -37,6 +41,10 @@ def main():
Install Pywin32 to the computer
"""
args
=
parse_arguments
()
if
args
.
mode
!=
default_mode
:
change_architect
=
True
else
:
change_architect
=
False
if
sys
.
hexversion
<
0x02060000
:
print
"Not a 2.6+ version Python is running, commencing update"
subprocess
.
Popen
(
...
...
@@ -47,7 +55,7 @@ def main():
pywin32_version
=
str
(
219
)
if
sys
.
hexversion
<
0x02070000
:
if
(
windowsclasses
.
DecideArchitecture
.
Is64Windows
()
and
not
args
.
change_architect
):
and
not
change_architect
):
subprocess
.
Popen
(
"
%
s
\\
x64
\\
pywin32-
%
s.win-amd64-py2.6.exe"
%
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
...
...
@@ -59,7 +67,7 @@ def main():
pywin32_version
))
.
wait
()
elif
sys
.
hexversion
<
0x02080000
:
if
(
windowsclasses
.
DecideArchitecture
.
Is64Windows
()
and
not
args
.
change_architect
):
and
not
change_architect
):
subprocess
.
Popen
(
"
%
s
\\
x64
\\
pywin32-
%
s.win-amd64-py2.7.exe"
%
(
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
)),
...
...
Csók Tamás
@SM0FZR
mentioned in issue
#3 (closed)
Jun 16, 2015
mentioned in issue
#3 (closed)
mentioned in issue #3
Toggle commit list
Csók Tamás
@SM0FZR
mentioned in issue
#6 (closed)
Jun 16, 2015
mentioned in issue
#6 (closed)
mentioned in issue #6
Toggle commit list
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment