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

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26