[Pkg-owncloud-commits] [python-owncloud] 72/96: This should fix all the version issues we were having.
Sandro Knauß
hefee-guest at moszumanska.debian.org
Fri Nov 22 01:28:29 UTC 2013
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository python-owncloud.
commit 8537d041c0ac10023dbbd48a1e0f6f3d49598029
Author: Craig <csawyer at yumaed.org>
Date: Wed Apr 3 13:26:38 2013 -0700
This should fix all the version issues we were having.
It's using pkg_resources now, and there is a pre-commit script that (if put in .git/hooks/) will make sure at commit time, that the latest head is in the file.
---
csync/version.dat | 2 +-
csync/version.py | 19 +++++++++++++------
pre-commit | 11 +++++++++++
3 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/csync/version.dat b/csync/version.dat
index 4ed816b..081e629 100644
--- a/csync/version.dat
+++ b/csync/version.dat
@@ -1 +1 @@
-{"head": "5c32717e4b3770da29c4ba61004be2e0239c2616", "float": 0.2, "string": "0.2"}
\ No newline at end of file
+{"head": "b8582bce785693276a258ec115bd1aa75673af8c", "float": 0.2, "string": "0.2"}
\ No newline at end of file
diff --git a/csync/version.py b/csync/version.py
index d21a980..d49bba1 100644
--- a/csync/version.py
+++ b/csync/version.py
@@ -1,6 +1,10 @@
import subprocess
import json
import os
+import pkg_resources
+
+verfile = pkg_resources.resource_filename(__name__, 'version.dat')
+
class ver(object):
def __init__(self, verfile='version.dat'):
self.verfile = verfile
@@ -88,8 +92,10 @@ class gitVersion(ver):
"""if git is around, return the current version and save it.
otherwise return the saved copy, or 00 if not already saved.
"""
- gitdir = os.path.join(os.path.dirname(os.path.abspath(self.verfile)),'.git')
+ gitdir = os.path.join(os.path.dirname(os.path.abspath(self.verfile)),'..','.git')
if not os.path.exists(gitdir):
+ if self.version.has_key('head'):
+ return self.version['head']
return '00'
cmd = 'git rev-parse --verify HEAD'.split()
try:
@@ -113,12 +119,13 @@ class gitVersion(ver):
def asHead(self):
return self.getHeadVersion()
-BASE_DIR = os.path.abspath(os.path.dirname(__file__))
-if os.path.exists(os.path.join(BASE_DIR, 'devel')):
- version = gitVersion(os.path.join(BASE_DIR, 'version.dat'))
-else:
- version = ver(os.path.join(BASE_DIR, 'version.dat'))
+#BASE_DIR = os.path.abspath(os.path.dirname(__file__))
+#if os.path.exists(os.path.join(BASE_DIR, 'devel')):
+# version = gitVersion(os.path.join(BASE_DIR, 'version.dat'))
+#else:
+# version = ver(os.path.join(BASE_DIR, 'version.dat'))
+version = gitVersion(verfile)
if __name__ == '__main__':
print 'Testing version.'
diff --git a/pre-commit b/pre-commit
new file mode 100755
index 0000000..a6df5c2
--- /dev/null
+++ b/pre-commit
@@ -0,0 +1,11 @@
+#!/bin/sh
+#
+# An example hook script to verify what is about to be committed.
+# Called by "git commit" with no arguments. The hook should
+# exit with non-zero status after issuing an appropriate message if
+# it wants to stop the commit.
+#
+# To enable this hook, rename this file to "pre-commit".
+
+#set the version
+python -c 'from csync import version; version.version.asHead'
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/python-owncloud.git
More information about the Pkg-owncloud-commits
mailing list