Skip to content
This repository has been archived by the owner on Sep 8, 2022. It is now read-only.

Commit

Permalink
add windows exe and installer building
Browse files Browse the repository at this point in the history
  • Loading branch information
dweaver committed May 16, 2014
1 parent 61be111 commit 6243d86
Show file tree
Hide file tree
Showing 8 changed files with 112 additions and 22 deletions.
6 changes: 6 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
History
=======

0.7.11 (2014-05-16)
-------------------

- Windows executable and installer
- fixed tree output for Windows

0.7.10 (2014-05-08)
-------------------

Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ You can build Exoline for Windows. On a Windows machine, do this:
- install PyInstaller (`pip install pyinstaller`)
- in the Exoline root directory, run (`pyinstaller exo.spec`)
- `exo.exe` and its dependencies are in dist\exo\
- run `copy dist\exo\exo.exe dist\exo\exo` so that Windows users don't need to type .exe

Build the installer this way:

- install Inno Setup 5.5.4 from here: http://www.innosetup.com/
- open innosetup.iss
- update Source in the Files section to point to dist\exo folder on your system

What's New?
-----------
Expand Down
5 changes: 4 additions & 1 deletion exo.spec
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
# -*- mode: python -*-
a = Analysis(['exoline\\exo.py'],
pathex=['C:\\Users\\danw\\Source\\Repos\\exoline'],
hiddenimports=[],
hiddenimports=['exoline.plugins'],
hookspath=None,
runtime_hooks=None)
a.datas += [
('jsonschema\schemas\draft3.json', 'c:\python27\lib\site-packages\jsonschema\schemas\draft3.json', 'DATA'),
('jsonschema\schemas\draft4.json', 'c:\python27\lib\site-packages\jsonschema\schemas\draft4.json', 'DATA')]
pyz = PYZ(a.pure)
exe = EXE(pyz,
a.scripts,
Expand Down
2 changes: 1 addition & 1 deletion exoline/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.7.10'
__version__ = '0.7.11'
51 changes: 33 additions & 18 deletions exoline/exo.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,28 +337,43 @@
'{{ helpoption }}': ''' -h --help Show this screen.''',
}

# load plugins. use timezone because this file may be running
# as a script in some other location.
plugin_path = os.path.join(os.path.dirname(timezone.__file__), 'plugins')

plugin_names = [os.path.basename(f)[:-3]
for f in glob.glob(plugin_path + "/*.py")
if not os.path.basename(f).startswith('_')]

plugins = []
for module_name in plugin_names:
try:
plugin = importlib.import_module('plugins.' + module_name)
except:
plugin = importlib.import_module('exoline.plugins.' + module_name, package='test')
if platform.system() != 'Windows':
# load plugins. use timezone because this file may be running
# as a script in some other location.
plugin_path = os.path.join(os.path.dirname(timezone.__file__), 'plugins')

# instantiate plugin
p = plugin.Plugin()
plugins.append(p)
plugin_names = [os.path.basename(f)[:-3]
for f in glob.glob(plugin_path + "/*.py")
if not os.path.basename(f).startswith('_')]

# get documentation
cmd_doc[p.command()] = plugin.__doc__
for module_name in plugin_names:
try:
plugin = importlib.import_module('plugins.' + module_name)
except:
plugin = importlib.import_module('exoline.plugins.' + module_name, package='test')

# instantiate plugin
p = plugin.Plugin()
plugins.append(p)

# get documentation
cmd_doc[p.command()] = plugin.__doc__
else:
try:
try:
from ..exoline.plugins import spec
except:
from exoline.plugins import spec
p = spec.Plugin()
plugins.append(p)
cmd_doc[p.command()] = spec.__doc__
except Exception as ex:
import traceback
traceback.print_exc()
print("Couldn't import spec......")
pprint(ex)
print('yup, that was an exception.')

# perform substitutions on command documentation
for k in cmd_doc:
Expand Down
4 changes: 2 additions & 2 deletions exoline/plugins/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import glob
__all__ = [os.path.basename(f)[:-3]
for f in glob.glob(os.path.dirname(__file__) + "/*.py")
if not os.path.basename(f).startswith('_')]
for f in glob.glob(os.path.join(os.path.dirname(__file__),"*.py"))
if not os.path.basename(f).startswith('_')]
57 changes: 57 additions & 0 deletions innosetup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!

[Setup]
; NOTE: The value of AppId uniquely identifies this application.
; Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{995A883B-B090-439D-966B-B32C8B938AC4}
AppName=Exoline
AppVersion=0.7.11
;AppVerName=Exoline 0.7.11
AppPublisher=Exosite
AppPublisherURL=https://github.com/exosite/exoline
AppSupportURL=https://github.com/exosite/exoline/issues
AppUpdatesURL=https://github.com/exosite/exoline
DefaultDirName={pf}\Exoline
DefaultGroupName=Exoline
AllowNoIcons=yes
Compression=lzma
SolidCompression=yes
ChangesEnvironment=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"

[Files]
Source: "C:\Users\danw\Source\Repos\exoline\dist\exo\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files

[Files]
Source: "website.url"; DestDir: "{app}"

[Icons]
Name: "{group}\Source code and documentation"; Filename: "{app}\website.url"
Name: "{group}\{cm:UninstallProgram,Exoline}"; Filename: "{uninstallexe}"

[Registry]
Root: HKLM; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Check: NeedsAddPath('{app}')


[Code]
function NeedsAddPath(Param: string): boolean;
var
OrigPath: string;
begin
if not RegQueryStringValue(HKEY_LOCAL_MACHINE,
'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',
'Path', OrigPath)
then begin
Result := True;
exit;
end;
// look for the path with leading and trailing semicolon
// Pos() returns 0 if not found
Result := Pos(';' + Param + ';', ';' + OrigPath + ';') = 0;
end;
2 changes: 2 additions & 0 deletions website.url
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=http://github.com/exosite/exoline

0 comments on commit 6243d86

Please sign in to comment.