Rev 37: Second take at setup guarding. in http://people.canonical.com/~robertc/baz2.0/plugins/avahi/trunk

Robert Collins robertc at robertcollins.net
Mon Mar 1 05:20:54 GMT 2010


At http://people.canonical.com/~robertc/baz2.0/plugins/avahi/trunk

------------------------------------------------------------
revno: 37
revision-id: robertc at robertcollins.net-20100301052053-tnqc81obrem486b2
parent: james at jamesh.id.au-20080512020347-i2g1acl4ylk4fpav
committer: Robert Collins <robertc at robertcollins.net>
branch nick: trunk
timestamp: Mon 2010-03-01 16:20:53 +1100
message:
  Second take at setup guarding.
=== modified file '__init__.py'
--- a/__init__.py	2008-05-12 02:03:47 +0000
+++ b/__init__.py	2010-03-01 05:20:53 +0000
@@ -43,13 +43,7 @@
 import browse
 """)
 
-version_info = (0, 3, 0, 'dev', 0)
-
-if version_info[3] == 'final':
-    version_string = '%d.%d.%d' % version_info[:3]
-else:
-    version_string = '%d.%d.%d%s%d' % version_info
-__version__ = version_string
+from version import *
 
 
 # Register hooks to advertise branches.

=== modified file 'setup.py'
--- a/setup.py	2008-02-13 10:52:18 +0000
+++ b/setup.py	2010-03-01 05:20:53 +0000
@@ -18,21 +18,21 @@
 from distutils.core import setup
 import os
 
-# Get version number from this copy of bzr-avahi:
-globals = {}
-execfile(os.path.join(os.path.dirname(__file__), '__init__.py'), globals)
-version = globals['__version__']
-del globals
-
-setup(
-    name='bzr-avahi',
-    version=version,
-    maintainer='James Henstridge',
-    maintainer_email='james at jamesh.id.au',
-    description='Bazaar plugin to advertise and browse branches via mDNS',
-    license='GNU GPL',
-    url='https://launchpad.net/bzr-avahi',
-    packages=['bzrlib.plugins.avahi', 'bzrlib.plugins.avahi.tests'],
-    package_dir={'bzrlib.plugins.avahi': '.',
-                 'bzrlib.plugins.avahi.tests': 'tests'},
-)
+from version import *
+
+if __name__ == "__main__":
+    # Get version number from this copy of bzr-avahi:
+
+    setup(
+        name='bzr-avahi',
+        version=version,
+        maintainer='James Henstridge',
+        maintainer_email='james at jamesh.id.au',
+        description='Bazaar plugin to advertise and browse branches via mDNS',
+        license='GNU GPL',
+        url='https://launchpad.net/bzr-avahi',
+        packages=['bzrlib.plugins.avahi', 'bzrlib.plugins.avahi.tests'],
+        package_dir={'bzrlib.plugins.avahi': '.',
+                     'bzrlib.plugins.avahi.tests': 'tests'},
+    )
+

=== added file 'version.py'
--- a/version.py	1970-01-01 00:00:00 +0000
+++ b/version.py	2010-03-01 05:20:53 +0000
@@ -0,0 +1,25 @@
+# bzr-avahi - share and browse Bazaar branches with mDNS
+# Copyright (C) 2007-2008 James Henstridge
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+__all__ = ['version_info', '__version__']
+version_info = (0, 3, 0, 'dev', 0)
+
+if version_info[3] == 'final':
+    version_string = '%d.%d.%d' % version_info[:3]
+else:
+    version_string = '%d.%d.%d%s%d' % version_info
+__version__ = version_string




More information about the bazaar-commits mailing list