def svn_app_version(appname=None, fail_silently=bool(not settings.DEBUG)): """ foo.app {% svn_app_version "foo.app" %} project {% svn_app_version %} """ cname = 'svn_app_version' if appname: cname += '.' + appname version = cache.get(cname) if not version: if not appname: ## RED_FLAG: hard coded relative root! version = get_svn_revision(dn(dn(dn(abspath(__file__))))) elif appname == 'django': version = get_svn_revision() elif appname not in settings.INSTALLED_APPS: version = 'SVN-None' else: try: module = get_app(appname) except: if not fail_silently: raise version = 'SVN-Error' else: version = get_svn_revision(dn(abspath(module.__file__))) cache.set(cname, version, 60*60*24*30) return version
def current_svn_rev(): """Get the current SVN revision of the project.""" if not settings.DEBUG: return "" project_dir = getattr(settings, 'SVNDIR', None) or getattr(settings, 'BASEDIR', None) if project_dir: if isinstance(project_dir, list): return ', '.join([get_svn_revision(path) for path in project_dir]) else: return get_svn_revision(project_dir) else: return 'Define settings.SVNDIR or settings.BASEDIR'
def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = VERSION assert len(version) == 5 assert version[3] in ("alpha", "beta", "rc", "final") # Now build the two parts of the version number: # main = X.Y[.Z] # sub = .devN - for pre-alpha releases # | {a|b|c}N - for alpha, beta and rc releases parts = 2 if version[2] == 0 else 3 main = ".".join(str(x) for x in version[:parts]) sub = "" if version[3] == "alpha" and version[4] == 0: # At the toplevel, this would cause an import loop. from django.utils.version import get_svn_revision svn_revision = get_svn_revision()[4:] if svn_revision != "unknown": sub = ".dev%s" % svn_revision elif version[3] != "final": mapping = {"alpha": "a", "beta": "b", "rc": "c"} sub = mapping[version[3]] + str(version[4]) return main + sub
def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if VERSION[-1]: from django.utils.version import get_svn_revision v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision()) return v
def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = __VERSION__ assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'final') # Now build the two parts of the version number: # main = X.Y[.Z] # sub = .devN - for pre-alpha releases # | {a|b|c}N - for alpha, beta and rc releases parts = 2 if version[2] == 0 else 3 main = '.'.join(str(x) for x in version[:parts]) sub = '' if version[3] == 'alpha' and version[4] == 0: # At the toplevel, this would cause an import loop. from django.utils.version import get_svn_revision svn_revision = get_svn_revision()[4:] if svn_revision != 'unknown': sub = '.dev%s' % svn_revision elif version[3] != 'final': mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} sub = mapping[version[3]] + str(version[4]) return main + sub
def get_version(version=None): """Derives a PEP386-compliant version number from VERSION.""" if version is None: version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'final') # Now build the two parts of the version number: # main = X.Y[.Z] # sub = .devN - for pre-alpha releases # | {a|b|c}N - for alpha, beta and rc releases parts = 2 if version[2] == 0 else 3 main = '.'.join(str(x) for x in version[:parts]) sub = '' if version[3] == 'alpha' and version[4] == 0: # At the toplevel, this would cause an import loop. from django.utils.version import get_svn_revision svn_revision = get_svn_revision()[4:] if svn_revision != 'unknown': sub = '.dev%s' % svn_revision elif version[3] != 'final': mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} sub = mapping[version[3]] + str(version[4]) return main + sub
def thanks_to(self): import lino version = lino.__version__ from django.utils.version import get_svn_revision svn_rev = get_svn_revision(os.path.dirname(__file__)) if svn_rev != u'SVN-unknown': version += " " + svn_rev yield ("Lino", "http://lino.saffre-rumma.ee", version) import django yield ("Django", "http://www.djangoproject.com", django.get_version()) import reportlab yield ("ReportLab Toolkit", "http://www.reportlab.org/rl_toolkit.html", reportlab.Version) import yaml version = getattr(yaml, '__version__', '') yield ("PyYaml", "http://pyyaml.org/", version) import dateutil version = getattr(dateutil, '__version__', '') yield ("python-dateutil", "http://labix.org/python-dateutil", version) import sys version = "%d.%d.%d" % sys.version_info[:3] yield ("Python", "http://www.python.org/", version) try: # l:\snapshot\xhtml2pdf import ho.pisa as pisa version = getattr(pisa, '__version__', '') yield ("xhtml2pdf", "http://www.htmltopdf.org/", version) except ImportError: pisa = None
def get_version(): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:-1]]) if VERSION[-1]: import satchmo_store from django.utils.version import get_svn_revision v = '%s-%s-%s' % (v, VERSION[-1], get_svn_revision(path=satchmo_store.__path__[0])) return v
def get_version(svn=False): """Returns the version as a human-format string.""" v = pkg_resources.require("django_l10n_extensions")[0].version if svn: from django.utils.version import get_svn_revision import os svn_rev = get_svn_revision(os.path.dirname(__file__)) if svn_rev: v = '%s-%s' % (v, svn_rev) return v
def get_version(svn=False): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION]) if svn: from django.utils.version import get_svn_revision import os svn_rev = get_svn_revision(os.path.dirname(__file__)) if svn_rev: v = '%s-%s' % (v, svn_rev) return v
def get_version(svn=False, limit=3): "Returns the version as a human-format string." v = '.'.join([str(i) for i in VERSION[:limit]]) if svn and limit >= 3: from django.utils.version import get_svn_revision import os svn_rev = get_svn_revision(os.path.dirname(__file__)) if svn_rev: v = '%s.%s' % (v, svn_rev) return v
def get_version(svn=False): "Returns the version as a human-format string." v = ".".join([str(i) for i in VERSION]) if svn: from django.utils.version import get_svn_revision import os svn_rev = get_svn_revision(os.path.dirname(__file__)) if svn_rev: v = "%s-%s" % (v, svn_rev) return v
def get_svn_revision(): """ Returns the SVN revision in the form SVN-XXX, where XXX is the revision number. Returns SVN-unknown if anything goes wrong, such as an unexpected format of internal SVN files. """ try: from django.utils import version rev = version.get_svn_revision(tube.__path__[0]) except ImportError: rev = u'SVN-unknown' return rev
def get_version(): version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: if VERSION[3] != 'final': version = '%s %s %s' % (version, VERSION[3], VERSION[4]) from django.utils.version import get_svn_revision svn_rev = get_svn_revision() if svn_rev != u'SVN-unknown': version = "%s %s" % (version, svn_rev) return version
def get_version(): version = "%s.%s" % (VERSION[0], VERSION[1]) if VERSION[2]: version = "%s.%s" % (version, VERSION[2]) if VERSION[3:] == ("alpha", 0): version = "%s pre-alpha" % version else: if VERSION[3] != "final": version = "%s %s %s" % (version, VERSION[3], VERSION[4]) from django.utils.version import get_svn_revision svn_rev = get_svn_revision() if svn_rev != u"SVN-unknown": version = "%s %s" % (version, svn_rev) return version
def get_version(): """ Taked from django one. Merengue will use same version scheme """ version = '%s.%s' % (VERSION[0], VERSION[1]) if VERSION[2]: version = '%s.%s' % (version, VERSION[2]) if VERSION[3:] == ('alpha', 0): version = '%s pre-alpha' % version else: if VERSION[3] != 'final': version = '%s %s %s' % (version, VERSION[3], VERSION[4]) from os import path from django.utils.version import get_svn_revision svn_rev = get_svn_revision(path.dirname(path.abspath(__file__))) if svn_rev != u'SVN-unknown': version = "%s %s" % (version, svn_rev) return version
def thanks_to(self): import lino version = lino.__version__ from django.utils.version import get_svn_revision svn_rev = get_svn_revision(os.path.dirname(__file__)) if svn_rev != u"SVN-unknown": version += " " + svn_rev yield ("Lino", "http://lino.saffre-rumma.ee", version) import django yield ("Django", "http://www.djangoproject.com", django.get_version()) import reportlab yield ("ReportLab Toolkit", "http://www.reportlab.org/rl_toolkit.html", reportlab.Version) import yaml version = getattr(yaml, "__version__", "") yield ("PyYaml", "http://pyyaml.org/", version) import dateutil version = getattr(dateutil, "__version__", "") yield ("python-dateutil", "http://labix.org/python-dateutil", version) import sys version = "%d.%d.%d" % sys.version_info[:3] yield ("Python", "http://www.python.org/", version) try: # l:\snapshot\xhtml2pdf import ho.pisa as pisa version = getattr(pisa, "__version__", "") yield ("xhtml2pdf", "http://www.htmltopdf.org/", version) except ImportError: pisa = None
def _add_vcs_reversion(self): """ Add subversion/git reversion number to version string, if exist """ if "SVN" in self["version"] or "git" in self["version"]: return location = dict.get(self, "location") svn_dir = os.path.join(location, ".svn") if os.path.isdir(svn_dir): svn_revision = get_svn_revision(location) if svn_revision != "SVN-unknown": self["version"] += " - SVN revision: %s" % svn_revision return git_dir = os.path.join(location, ".git") if os.path.isdir(git_dir): commit_info = self.get_commit_info(location) if commit_info: self["version"] += " - Last git commit: %s" % commit_info
def get_version(version=None): if version is None: version = VERSION assert len(version) == 5 assert version[3] in ('alpha', 'beta', 'rc', 'final') parts = 2 if version[2] == 0 else 3 main = '.'.join(str(x) for x in version[:parts]) sub = '' if version[3] == 'alpha' and version[4] == 0: from django.utils.version import get_svn_revision svn_revision = get_svn_revision()[4:] if svn_revision != 'unknown': sub = '.dev%s' % svn_revision elif version[3] != 'final': mapping = {'alpha': 'a', 'beta': 'b', 'rc': 'c'} sub = mapping[version[3]] + str(version[4]) return main + sub
Webframework Django. Last commit info: ~~~~~~~~~~~~~~~~~ $LastChangedDate$ $Rev$ $Author$ :copyleft: 2007-2008 by the PyLucid team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ try: from django.utils.version import get_svn_revision svn_revision = get_svn_revision("PyLucid") if svn_revision == u'SVN-unknown': # No SVN checkout, a release? svn_revision = "" else: # Add a space between the normal version number # and the SVN revision number. svn_revision = " " + svn_revision except ImportError: # using /setup.py in the lite version without django in the sys.path svn_revision = "" # PyLucid Version String # Important for setuptools: # - Only use . as a separator # - No spaces: "0.8.0 RC2" -> "0.8.0RC2"
import os import sys from creole_parser import BlockRules, Parser from creole2html import HtmlEmitter from html2creole import Html2CreoleParser, Html2CreoleEmitter try: from django.utils.version import get_svn_revision except ImportError: pass else: path = os.path.split(os.path.abspath(__file__))[0] svn_revision = get_svn_revision(path) if svn_revision != u'SVN-unknown': svn_revision = svn_revision.replace("-", "").lower() __version__ += (svn_revision,) VERSION_STRING = '.'.join(str(part) for part in __version__) API_STRING = '.'.join(str(integer) for integer in __api__) def creole2html(markup_string, debug=False, blog_line_breaks=True, **kwargs): """ convert creole markup into html code >>> creole2html(u'This is **creole //markup//**!') u'<p>This is <strong>creole <i>markup</i></strong>!</p>\\n'
def render(self, context): return get_svn_revision(self.path)
import os.path from base import Setting, SettingSet from forms import ImageFormWidget from django.forms.widgets import Textarea from django.utils.translation import ugettext_lazy as _ from django.conf import settings as djsettings from django.utils.version import get_svn_revision OSQA_VERSION = "Development Build" SVN_REVISION = get_svn_revision(djsettings.SITE_SRC_ROOT) MAINTAINANCE_MODE = Setting('MAINTAINANCE_MODE', None) SETTINGS_PACK = Setting('SETTINGS_PACK', "default") DJSTYLE_ADMIN_INTERFACE = Setting('DJSTYLE_ADMIN_INTERFACE', True) APP_URL = djsettings.APP_URL FORUM_SCRIPT_ALIAS = djsettings.FORUM_SCRIPT_ALIAS from basic import * from sidebar import * from email import * from extkeys import * from minrep import * from repgain import * from voting import * from upload import * from about import * from faq import *
import os.path from base import Setting, SettingSet, BaseSetting from django.forms.widgets import Textarea from django.utils.translation import ugettext_lazy as _ from django.conf import settings as djsettings from django.utils.version import get_svn_revision from forum.modules import get_modules_script_implementations OSQA_VERSION = "Development Build" SVN_REVISION = get_svn_revision(djsettings.SITE_SRC_ROOT) # We'll have to keep in mind this variable on every release. if SVN_REVISION == u'SVN-unknown': SVN_REVISION = u'SVN-1281' MAINTAINANCE_MODE = Setting('MAINTAINANCE_MODE', None) SETTINGS_PACK = Setting('SETTINGS_PACK', "default") DJSTYLE_ADMIN_INTERFACE = Setting('DJSTYLE_ADMIN_INTERFACE', True) NODE_MAN_FILTERS = Setting('NODE_MAN_FILTERS', []) APP_URL = djsettings.APP_URL APP_BASE_URL = djsettings.APP_BASE_URL FORCE_SCRIPT_NAME = djsettings.FORCE_SCRIPT_NAME OSQA_SKIN = djsettings.OSQA_DEFAULT_SKIN LANGUAGE_CODE = djsettings.LANGUAGE_CODE ADMIN_MEDIA_PREFIX = djsettings.ADMIN_MEDIA_PREFIX ONLINE_USERS = Setting('ONLINE_USERS', {})