/[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 1322 by jonathan, Mon Jun 30 12:01:50 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    def make_tuple(s):
81        return tuple(map(int, split(s, ".")[:3]))
82    
83    # wxPython
84    from wxPython.wx import __version__ as wxPython_version
85    versions['wxPython'] = wxPython_version
86    versions['wxPython-tuple'] = make_tuple(wxPython_version)
87    
88    # Python
89    versions['python'] = "%d.%d.%d" % sys.version_info[:3]
90    versions['python-tuple'] = sys.version_info[:3]
91    
92    # PySQLite
93    from sqlite import version as pysqlite_version
94    versions['pysqlite'] = pysqlite_version
95    versions['pysqlite-tuple'] = make_tuple(pysqlite_version)
96    
97    # SQLite
98    from _sqlite import sqlite_version
99    versions['sqlite'] = sqlite_version()
100    versions['sqlite-tuple'] = make_tuple(sqlite_version())
101    
102    # GDAL
103    from  Thuban.Model.resource import has_gdal_support
104    if has_gdal_support():
105        from gdalwarp import get_gdal_version
106        versions['gdal'] = get_gdal_version()
107        versions['gdal-tuple'] = make_tuple(get_gdal_version())
108    
109    from wxproj import get_proj_version, get_gtk_version
110    
111    # GTK
112    gtk_ver = get_gtk_version()
113    if gtk_ver:
114        versions['gtk'] = ".".join(map(str, gtk_ver))
115        versions['gtk-tuple'] = gtk_ver
116    
117    # PROJ
118    proj_ver = get_proj_version()
119    if proj_ver:
120        versions['proj'] = ".".join(map(str, proj_ver))
121        versions['proj-tuple'] = proj_ver
122    
123    def verify_versions():
124        """Verifies that the versions of the libraries Thuban requires
125        are correct.
126    
127        Returns a non-empty list of strings indicating which libraries
128        are wrong, or the empty list if everthing is ok.
129        """
130    
131        #
132        # The 'name' below must correspong to an mapping in 'versions'.
133        # There must also exist a 'name'-tuple mapping.
134        #
135        #         title           name       version
136        list = [["Python",      "python",   (2, 2, 1)],
137                ["wxPython",    "wxPython", (2, 4, 0)],
138                ["SQLite",      "sqlite",   (2, 8, 0)],
139                ["PySQLite",    "pysqlite", (0, 4, 1)],
140                ["PROJ",        "proj",     (4, 4, 5)],
141                ["GTK",         "gtk",      (1, 2, 3)],
142                ["GDAL",        "gdal",     (1, 1, 8)]]
143    
144        errors = []
145        for title, name, version in list:
146            tup = versions.get("%s-tuple" % name, None)
147            if tup and tup < version:
148                errors.append(_("%s %s < %s") % \
149                    (title, versions[name], ".".join(map(str, version))))
150    
151        return errors
152            
153  if __name__ == "__main__":  if __name__ == "__main__":
154      print longversion      print longversion
155    

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26