Package pytils
[hide private]

Source Code for Package pytils

 1  # -*- coding: utf-8 -*- 
 2  # pytils - simple processing for russian strings 
 3  # Copyright (C) 2006-2007  Yury Yurevich 
 4  # 
 5  # http://www.pyobject.ru/projects/pytils/ 
 6  # 
 7  # This program is free software; you can redistribute it and/or 
 8  # modify it under the terms of the GNU General Public License 
 9  # as published by the Free Software Foundation, version 2 
10  # of the License. 
11  # 
12  # This program is distributed in the hope that it will be useful, 
13  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
15  # GNU General Public License for more details. 
16   
17  """ 
18  Simple processing for russian strings 
19  """ 
20   
21  __id__ = __revision__ = "$Id: __init__.py 102 2007-07-12 12:33:36Z the.pythy $" 
22  __url__ = "$URL: https://pythy.googlecode.com/svn/tags/pytils/0_2_2/pytils/__init__.py $" 
23  __all__ = ["numeral", "dt", "translit", "test", "utils"] 
24   
25  # версия pytils 
26  VERSION_MAJOR = 0  #: Major version of pytils (i.e. branch) 
27  VERSION_MINOR = 2  #: Minor version of pytils (i.e. release) 
28  VERSION_TINY = 2   #: Tiny version of pytils (i.e. subrelease) 
29   
30  VERSION = "%d.%d.%d" % (VERSION_MAJOR, VERSION_MINOR, VERSION_TINY)  #: Version's string 
31   
32  REL_DATE = '20070712'  #: Release date 
33   
34   
35 -def _get_svn_date_from_id(id_string):
36 """Returns date of last update (extract from __id__)""" 37 if id_string.replace('$', '') == "Id": 38 return REL_DATE 39 else: 40 return id_string.split()[3].replace('-', '')
41 42 43 _module_dates = [_get_svn_date_from_id(__id__), ] #: Last changes in submodules 44 45 # импорт модулей 46 for _module_name in __all__: 47 _imported_module = __import__("pytils."+_module_name, 48 globals(), 49 locals(), 50 ["pytils"]) 51 _module_dates.append(_get_svn_date_from_id(_imported_module.__id__)) 52 53 SVN_DATE = max(_module_dates) #: Last change in submodules 54 55 # если взяли с svn, то версия будет 56 # X.Y.Z-svnYYYYMMDD, где X.Y.Z - номер оригинальной версии, 57 # а YYYYMMDD - дата последнего изменения в модулях 58 # единственная сложность остается, если взяли не через svn, 59 # а через webdav, в этом случае Id не проставляется и версия 60 # будет оригинальной. Это можно обойти, скажем, учитывая дату 61 # изменения файлов, но я пока не вижу в этом смысла. 62 if SVN_DATE > REL_DATE: 63 VERSION = "%s-svn%s" % (VERSION, SVN_DATE) #: Version's string (with appended svndate) 64