/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/version.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/version.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1288 by jonathan, Mon Jun 23 10:47:44 2003 UTC revision 1480 by bh, Thu Jul 24 17:52:48 2003 UTC
# Line 1  Line 1 
 #!/usr/bin/env python  
 #  
1  # Copyright (C) 2002, 2003 by Intevation GmbH  # Copyright (C) 2002, 2003 by Intevation GmbH
2  # Authors:  # Authors:
3  # Thomas Koester <[email protected]>  # Thomas Koester <[email protected]>
# Line 21  version = 'cvs' Line 19  version = 'cvs'
19  append_date = 1  append_date = 1
20    
21    
22  import os, os.path  import sys, os, os.path
23  import time  import time
24    from string import split
25    
26    from Thuban import  _
27    
28    
29  if __name__ == "__main__":  if __name__ == "__main__":
30      import sys      import sys
# Line 54  def get_changelog_date(): Line 56  def get_changelog_date():
56          file.close()          file.close()
57      except:      except:
58          return ""          return ""
59      return '\n  ChangeLog %s' % line.split(" ")[0]      return 'ChangeLog %s' % line.split(" ")[0]
60    
61    
62    #
63    # Fill in versions with the different versions of the libraries
64    # that Thuban is using or requires (only if those libraries are
65    # available.
66    #
67    
68    versions = {}
69    
70  if append_date:  if append_date:
71      version = '%s-%s' % (version, get_date('%Y%m%d'))      version = '%s-%s' % (version, get_date('%Y%m%d'))
72  #longversion = '%s%s' % (version, get_changelog_date())  versions['thuban'] = version
 longversion = 'Release Version 0.8'  
73    
74    #longversion = '%s\n%s' % (version, get_changelog_date())
75    longversion = 'Release Version 0.8.1'
76    versions['thuban-long'] = longversion
77    
78    def make_tuple(s):
79        return tuple(map(int, split(s, ".")[:3]))
80    
81    # wxPython
82    from wxPython.wx import __version__ as wxPython_version
83    versions['wxPython'] = wxPython_version
84    versions['wxPython-tuple'] = make_tuple(wxPython_version)
85    
86    # Python
87    versions['python'] = "%d.%d.%d" % sys.version_info[:3]
88    versions['python-tuple'] = sys.version_info[:3]
89    
90    # PySQLite
91    from sqlite import version as pysqlite_version
92    versions['pysqlite'] = pysqlite_version
93    versions['pysqlite-tuple'] = make_tuple(pysqlite_version)
94    
95    # SQLite
96    from _sqlite import sqlite_version
97    versions['sqlite'] = sqlite_version()
98    versions['sqlite-tuple'] = make_tuple(sqlite_version())
99    
100    # GDAL
101    from  Thuban.Model.resource import has_gdal_support
102    if has_gdal_support():
103        from gdalwarp import get_gdal_version
104        versions['gdal'] = get_gdal_version()
105        versions['gdal-tuple'] = make_tuple(get_gdal_version())
106    
107    from wxproj import get_proj_version, get_gtk_version
108    
109    # GTK
110    gtk_ver = get_gtk_version()
111    if gtk_ver:
112        versions['gtk'] = ".".join(map(str, gtk_ver))
113        versions['gtk-tuple'] = gtk_ver
114    
115    # PROJ
116    proj_ver = get_proj_version()
117    if proj_ver:
118        versions['proj'] = ".".join(map(str, proj_ver))
119        versions['proj-tuple'] = proj_ver
120    
121    def verify_versions():
122        """Verifies that the versions of the libraries Thuban requires
123        are correct.
124    
125        Returns a non-empty list of strings indicating which libraries
126        are wrong, or the empty list if everthing is ok.
127        """
128    
129        #
130        # The 'name' below must correspong to an mapping in 'versions'.
131        # There must also exist a 'name'-tuple mapping.
132        #
133        #         title           name       version
134        list = [["Python",      "python",   (2, 2, 1)],
135                ["wxPython",    "wxPython", (2, 4, 0)],
136                ["SQLite",      "sqlite",   (2, 8, 0)],
137                ["PySQLite",    "pysqlite", (0, 4, 1)],
138                ["PROJ",        "proj",     (4, 4, 5)],
139                ["GTK",         "gtk",      (1, 2, 3)],
140                ["GDAL",        "gdal",     (1, 1, 8)]]
141    
142        errors = []
143        for title, name, version in list:
144            tup = versions.get("%s-tuple" % name, None)
145            if tup and tup < version:
146                errors.append(_("%s %s < %s") % \
147                    (title, versions[name], ".".join(map(str, version))))
148    
149        return errors
150            
151  if __name__ == "__main__":  if __name__ == "__main__":
152      print longversion      print longversion
153    

Legend:
Removed from v.1288  
changed lines
  Added in v.1480

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26