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

Legend:
Removed from v.925  
changed lines
  Added in v.1319

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26