labs-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r744630 - in /labs/orthrus/trunk: SConstruct include/orthrus_version.h
Date Sun, 15 Feb 2009 08:25:04 GMT
Author: pquerna
Date: Sun Feb 15 08:25:03 2009
New Revision: 744630

URL: http://svn.apache.org/viewvc?rev=744630&view=rev
Log:
Read version number in SConstruct from header file.

Added:
    labs/orthrus/trunk/include/orthrus_version.h   (with props)
Modified:
    labs/orthrus/trunk/SConstruct

Modified: labs/orthrus/trunk/SConstruct
URL: http://svn.apache.org/viewvc/labs/orthrus/trunk/SConstruct?rev=744630&r1=744629&r2=744630&view=diff
==============================================================================
--- labs/orthrus/trunk/SConstruct (original)
+++ labs/orthrus/trunk/SConstruct Sun Feb 15 08:25:03 2009
@@ -17,14 +17,23 @@
 
 EnsureSConsVersion(1, 2, 0)
 
+import re
 from os.path import join as pjoin
 
 opts = Variables('build.py')
 
-# TODO: Move these to be gathered from a version header file.
-orthrus_major = 0
-orthrus_minor = 1
-orthrus_patch = 0
+def read_version(prefix, path):
+  version_re = re.compile("(.*)%s_(?P<id>MAJOR|MINOR|PATCH)_VERSION(\s+)(?P<num>\d)(.*)"
% prefix)
+  versions = {}
+  fp = open(path, 'rb')
+  for line in fp.readlines():
+    m = version_re.match(line)
+    if m:
+      versions[m.group('id')] = int(m.group('num'))
+  fp.close()
+  return (versions['MAJOR'], versions['MINOR'], versions['PATCH'])
+
+orthrus_major, orthrus_minor, orthrus_patch = read_version('ORTHRUS', 'include/orthrus_version.h')
 
 opts.Add(PathVariable('PREFIX', 'Prefix of where to install', '/usr/local', validator=PathVariable.PathAccept))
 opts.Add(PathVariable('DESTDIR', 'Prefix for packaging purposes', '/', validator=PathVariable.PathAccept))

Added: labs/orthrus/trunk/include/orthrus_version.h
URL: http://svn.apache.org/viewvc/labs/orthrus/trunk/include/orthrus_version.h?rev=744630&view=auto
==============================================================================
--- labs/orthrus/trunk/include/orthrus_version.h (added)
+++ labs/orthrus/trunk/include/orthrus_version.h Sun Feb 15 08:25:03 2009
@@ -0,0 +1,44 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * @file orthrus_version.h
+ * @brief Defines the Proton Web Toolkit's version information.
+ */
+
+#ifndef _APACHE_ORTHRUS_VERSION_H_
+#define _APACHE_ORTHRUS_VERSION_H_
+
+#include "apr_general.h"
+
+#define ORTHRUS_MAJOR_VERSION 0
+#define ORTHRUS_MINOR_VERSION 1
+#define ORTHRUS_PATCH_VERSION 0
+
+#define ORTHRUS_DEVBUILD_BOOLEAN 1
+
+#if ORTHRUS_DEVBUILD_BOOLEAN
+#define ORTHRUS_VER_ADD_STRING "-dev"
+#else
+#define ORTHRUS_VER_ADD_STRING ""
+#endif
+
+#define ORTHRUS_VERSION_STRING  APR_STRINGIFY(ORTHRUS_MAJOR_VERSION) "." \
+                            APR_STRINGIFY(ORTHRUS_MINOR_VERSION) "." \
+                            APR_STRINGIFY(ORTHRUS_PATCH_VERSION) \
+                            PWT_VER_ADD_STRING
+
+#endif /* _APACHE_ORTHRUS_VERSION_H_ */

Propchange: labs/orthrus/trunk/include/orthrus_version.h
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: labs/orthrus/trunk/include/orthrus_version.h
------------------------------------------------------------------------------
    svn:keywords = Date Revision Author HeadURL Id

Propchange: labs/orthrus/trunk/include/orthrus_version.h
------------------------------------------------------------------------------
    svn:mime-type = text/plain



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@labs.apache.org
For additional commands, e-mail: commits-help@labs.apache.org


Mime
View raw message