Permalink
Browse files

windows port and build configuration

  • Loading branch information...
1 parent df88e5b commit 6a299a7bc2c9e65739c340d219bed066cfb1cbb9 @rumpeltux rumpeltux committed May 22, 2011
Showing with 67 additions and 16 deletions.
  1. +19 −0 INSTALL
  2. +21 −7 odml-gui
  3. +4 −0 odml/tools/xmlparser.py
  4. +23 −9 setup.py
View
19 INSTALL
@@ -0,0 +1,19 @@
+To install the package simply run:
+
+ sudo python setup.py install --prefix /usr
+
+A windows package is seperately bundled.
+To build the windows package from source, follow these instructions:
+
+1. Install the following software (ALWAYS use the 32-bit versions!)
+ * python-2.7 http://www.python.org/getit/windows/
+ * pygtk-windows all-in-one installer: http://www.pygtk.org/downloads.html
+ * py2exe: http://sourceforge.net/projects/py2exe/files/py2exe/0.6.9/py2exe-0.6.9.win32-py2.7.exe/download
+ * setuptools: http://pypi.python.org/pypi/setuptools#files
+
+2. Install build dependencies
+ # easy_install.exe lxml
+
+3. Compile
+ # python.exe setup.py py2exe
+
View
@@ -1,4 +1,5 @@
#!/usr/bin/env python
+import os, sys
import gtk
import gobject
@@ -672,6 +673,18 @@ class Editor(gtk.Window):
self._info_bar.show_info("Editing failed: %s" % error.message)
raise #reraise the exception for a traceback
+def get_image_path():
+ try:
+ filename = __file__
+ except:
+ filename = sys.argv[0]
+
+ path = os.path.join(os.path.dirname(filename), 'images')
+ other_paths = ['/usr/share/pixmaps', '/usr/local/share/pixmaps', 'share/pixmaps']
+ while not os.path.exists(path):
+ path = other_paths.pop()
+ return path
+
def register_stock_icons():
icons = [('odml-logo', '_odML', 0, 0, '')]
gtk.stock_add(icons)
@@ -680,8 +693,7 @@ def register_stock_icons():
factory = gtk.IconFactory()
factory.add_default()
- import os
- img_dir = os.path.join(os.path.dirname(__file__), 'images')
+ img_dir = get_image_path()
img_path = os.path.join(img_dir, 'odMLIcon.png')
try:
@@ -709,8 +721,7 @@ def load_pixbuf(path):
def load_icon_pixbufs():
icons = []
- import os
- img_dir = os.path.join(os.path.dirname(__file__), 'images')
+ img_dir = get_image_path()
files = os.listdir (img_dir)
for f in files:
if f.startswith("odMLIcon"):
@@ -726,9 +737,12 @@ def main(filename=None):
gtk.main()
if __name__ == '__main__':
- from ctypes import *
- libc = cdll.LoadLibrary("libc.so.6")
- res = libc.prctl (15, 'odMLEditor', 0, 0, 0)
+ try: # this works only on linux
+ from ctypes import *
+ libc = cdll.LoadLibrary("libc.so.6")
+ res = libc.prctl (15, 'odMLEditor', 0, 0, 0)
+ except:
+ pass
from optparse import OptionParser
parser = OptionParser()
(options, args) = parser.parse_args()
View
@@ -13,6 +13,10 @@
from dumper import dumpSection
from lxml import etree as ET
from lxml.builder import E
+
+# this is needed for py2exe to include lxml completely
+from lxml import _elementpath as _dummy
+
import sys
from StringIO import StringIO
View
@@ -1,8 +1,15 @@
#!/usr/bin/env python
-
from distutils.core import setup
import os, glob
+kwargs = {}
+try:
+ # only necessary for the windows build
+ import py2exe
+ kwargs.update({'console': ['odml-gui']})
+except ImportError:
+ pass
+
#TODO install gui.py as /usr/local/bin/odml-gui or similar
setup(name='odML',
version='1.0',
@@ -11,15 +18,22 @@
author_email='fritsch+gnode@in.tum.de',
url='http://www.g-node.org/projects/odml',
packages=[
- 'odml',
- 'odml.tools',
- 'odml.tools.treemodel',
- 'odml.tools.gui',
- ],
+ 'odml',
+ 'odml.tools',
+ 'odml.tools.treemodel',
+ 'odml.tools.gui',
+ ],
scripts=['odml-gui'],
data_files=[
- ('share/applications', ['odml.desktop']),
- ('share/pixmaps', glob.glob(os.path.join("images", "*")))
- ]
+ ('share/applications', ['odml.desktop']),
+ ('share/pixmaps', glob.glob(os.path.join("images", "*")))
+ ],
+ options = {
+ 'py2exe': {
+ 'packages': 'odml',
+ 'includes': 'cairo, pango, pangocairo, atk, gobject, gio, lxml, gzip',
+ }
+ },
+ **kwargs
)

0 comments on commit 6a299a7

Please sign in to comment.