--- /dev/null
+include etc/*
+include etc/init.d/*
+include etc/quantum/plugins/openvswitch/*
+include etc/quantum/plugins/cisco/*
+include version.py
# License for the specific language governing permissions and limitations
# under the License.
-# If ../quantum/__init__.py exists, add ../ to Python search path, so that
-# it will override what happens to be installed in /usr/(local/)lib/python...
+import os
+import sys
+sys.path.insert(0, os.getcwd())
+import quantum.client.cli as cli
-import __init__
-
-try:
- import source_environment
-except ImportError:
- pass
-
-from quantum.cli import main as cli
-
-cli()
+cli.main()
# License for the specific language governing permissions and limitations
# under the License.
-# If ../quantum/__init__.py exists, add ../ to Python search path, so that
-# it will override what happens to be installed in /usr/(local/)lib/python...
-
-import __init__
-try:
- import source_environment
-except ImportError:
- pass
-
+import os
+import sys
+sys.path.insert(0, os.getcwd())
from quantum.server import main as server
server()
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 OpenStack LLC.
-# All Rights Reserved.
-#
-# Licensed 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.
-
-# See http://code.google.com/p/python-nose/issues/detail?id=373
-# The code below enables nosetests to work with i18n _() blocks
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
-
-import __builtin__
-import unittest
-setattr(__builtin__, '_', lambda x: x)
-
-
-class BaseTest(unittest.TestCase):
-
- def setUp(self):
- pass
-
-
-def setUp():
- pass
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-#!/usr/bin/env python
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2010 OpenStack, LLC
-# All Rights Reserved.
-#
-# Licensed 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.
-
-
-"""Unittest runner for quantum
-
-To run all test::
- python run_tests.py
-
-To run all unit tests::
- python run_tests.py unit
-
-To run all functional tests::
- python run_tests.py functional
-
-To run a single unit test::
- python run_tests.py unit.test_stores:TestSwiftBackend.test_get
-
-To run a single functional test::
- python run_tests.py functional.test_service:TestController.test_create
-
-To run a single unit test module::
- python run_tests.py unit.test_stores
-
-To run a single functional test module::
- python run_tests.py functional.test_stores
-"""
-
-import gettext
-import os
-import unittest
-import sys
-
-from quantum.common.test_lib import run_tests
-from nose import config
-from nose import core
-
-import quantum.tests.unit
-
-
-def main():
- c = config.Config(stream=sys.stdout,
- env=os.environ,
- verbosity=3,
- includeExe=True,
- traverseNamespace=True,
- plugins=core.DefaultPluginManager())
- c.configureWhere(quantum.tests.unit.__path__)
- sys.exit(run_tests(c))
-
-if __name__ == "__main__":
- main()
--- /dev/null
+[PLUGIN]
+# Quantum plugin provider module
+provider = quantum.plugins.sample.SamplePlugin.FakePlugin
+++ /dev/null
-include etc/*
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-#
-# Copyright 2011 Cisco Systems, Inc. All rights reserved.
-#
-# Licensed 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.
-#
-# @author: Sumit Naiksatam, Cisco Systems, Inc.
-#
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-include etc/*
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-try:
- from setuptools import setup, find_packages
-except ImportError:
- from ez_setup import use_setuptools
- use_setuptools()
- from setuptools import setup, find_packages
-
-Name = 'quantum-sample-plugin'
-ProjecUrl = "https://launchpad.net/quantum"
-Version = '2012.1dev'
-License = 'Apache License 2.0'
-# Change as required
-Author = 'Netstack'
-AuthorEmail = 'netstack@lists.launchpad.net'
-Maintainer = ''
-Summary = 'Sample functionalities for Quantum'
-ShortDescription = Summary
-Description = Summary
-
-requires = [
- 'quantum-common',
- 'quantum-server',
-]
-
-EagerResources = [
- 'quantum',
-]
-
-ProjectScripts = [
-]
-
-PackageData = {
-}
-
-DataFiles = [
-]
-
-setup(
- name=Name,
- version=Version,
- author=Author,
- author_email=AuthorEmail,
- description=ShortDescription,
- long_description=Description,
- license=License,
- scripts=ProjectScripts,
- install_requires=requires,
- include_package_data=True,
- packages=find_packages('lib'),
- package_data=PackageData,
- data_files=DataFiles,
- package_dir={'': 'lib'},
- eager_resources=EagerResources,
- namespace_packages=['quantum'],
-)
gettext.install('quantum', unicode=1)
-from quantum import cli_lib
+from quantum.client import cli_lib
from quantum.client import Client
#Configure logger for client - cli logger is a child of it
import sys
FORMAT = "json"
-LOG = logging.getLogger('quantum.cli_lib')
+LOG = logging.getLogger('quantum.client.cli_lib')
class OutputTemplate(object):
# and override the values in it if needed (e.g., run_tests.py in
# quantum/plugins/openvswitch/ )
test_config = {
- "plugin_name": "quantum.plugins.SamplePlugin.FakePlugin",
+ "plugin_name": "quantum.plugins.sample.SamplePlugin.FakePlugin",
}
from optparse import OptionParser
-from tools import source_environment
-import quantum.cli as qcli
+import quantum.client.cli as qcli
POSSIBLE_TOPDIR = os.path.normpath(os.path.join(os.path.abspath(sys.argv[0]),
os.pardir,
sys.path.append(os.getcwd())
-import tools.source_environment
from quantum.common.test_lib import run_tests
import quantum.plugins.cisco.tests.unit
# See http://code.google.com/p/python-nose/issues/detail?id=373
# The code below enables nosetests to work with i18n _() blocks
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
import __builtin__
import unittest
import quantum.db.api as db
import ovs_db
-CONF_FILE = find_config_file({}, None, "ovs_quantum_plugin.ini")
+CONF_FILE = find_config_file(
+ {"config_file": "etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini"},
+ None, "ovs_quantum_plugin.ini")
LOG.basicConfig(level=LOG.WARN)
LOG.getLogger("ovs_quantum_plugin")
This file should be run from the top dir in the quantum directory
-To run all test::
- python quantum/plugins/openvswitch/run_tests.py
-
-To run all unit tests::
- python quantum/plugins/openvswitch/run_tests.py unit
-
-To run all functional tests::
- python quantum/plugins/openvswitch/run_tests.py functional
-
-To run a single unit test::
- python quantum/plugins/openvswitch/run_tests.py \
- unit.test_stores:TestSwiftBackend.test_get
-
-To run a single functional test::
- python quantum/plugins/openvswitch/run_tests.py \
- functional.test_service:TestController.test_create
-
-To run a single unit test module::
- python quantum/plugins/openvswitch/run_tests.py unit.test_stores
-
-To run a single functional test module::
- python quantum/plugins/openvswitch/run_tests.py functional.test_stores
+To run all tests::
+ PLUGIN_DIR=quantum/plugins/openvswitch ./run_tests.sh
"""
import gettext
sys.path.append(os.getcwd())
sys.path.append(os.path.dirname(__file__))
-import tools.source_nonplugin_environment
import quantum.tests.unit
from quantum.common.test_lib import run_tests, test_config
os.chdir(cwd)
- working_dir = os.path.abspath("plugins/openvswitch-plugin/" +
- "lib/quantum/plugins/openvswitch")
+ working_dir = os.path.abspath("quantum/plugins/openvswitch")
c = config.Config(stream=sys.stdout,
env=os.environ,
verbosity=3,
from quantum.common import exceptions as exc
from quantum.db import api as db
-LOG = logging.getLogger('quantum.plugins.SamplePlugin')
+LOG = logging.getLogger('quantum.plugins.sample.SamplePlugin')
class QuantumEchoPlugin(object):
# See http://code.google.com/p/python-nose/issues/detail?id=373
# The code below enables nosetests to work with i18n _() blocks
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
import __builtin__
import unittest
def __init__(self, _1, _2):
# Ignore host and port parameters
self._req = None
- options = \
- dict(plugin_provider='quantum.plugins.SamplePlugin.FakePlugin')
+ plugin = 'quantum.plugins.sample.SamplePlugin.FakePlugin'
+ options = dict(plugin_provider=plugin)
self._api = server.APIRouterV1(options)
def request(self, method, action, body, headers):
import unittest
from quantum import api as server
-from quantum import cli_lib as cli
+from quantum.client import cli_lib as cli
from quantum.client import Client
from quantum.db import api as db
from quantum.tests.unit.client_tools import stubs as client_stubs
def setUp(self):
"""Prepare the test environment"""
options = {}
- options['plugin_provider'] = 'quantum.plugins.SamplePlugin.FakePlugin'
+ options['plugin_provider'] = \
+ 'quantum.plugins.sample.SamplePlugin.FakePlugin'
self.api = server.APIRouterV1(options)
self.tenant_id = "test_tenant"
from quantum import wsgi
from quantum.common import config
from quantum.common import extensions
-from quantum.plugins.SamplePlugin import QuantumEchoPlugin
+import sys
+print sys.path
+from quantum.plugins.sample.SamplePlugin import QuantumEchoPlugin
from quantum.tests.unit.extension_stubs import (StubExtension, StubPlugin,
StubPluginInterface,
StubBaseAppController,
#!/usr/bin/env python
-import tools.source_environment
-from quantum.run_tests import main as tests
+# vim: tabstop=4 shiftwidth=4 softtabstop=4
-tests()
+# Copyright 2010 OpenStack, LLC
+# All Rights Reserved.
+#
+# Licensed 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.
+
+
+"""Unittest runner for quantum
+
+To run all test::
+ python run_tests.py
+
+To run all unit tests::
+ python run_tests.py unit
+
+To run all functional tests::
+ python run_tests.py functional
+
+To run a single unit test::
+ python run_tests.py unit.test_stores:TestSwiftBackend.test_get
+
+To run a single functional test::
+ python run_tests.py functional.test_service:TestController.test_create
+
+To run a single unit test module::
+ python run_tests.py unit.test_stores
+
+To run a single functional test module::
+ python run_tests.py functional.test_stores
+"""
+
+import gettext
+import os
+import unittest
+import sys
+
+from quantum.common.test_lib import run_tests
+from nose import config
+from nose import core
+
+import quantum.tests.unit
+
+
+def main():
+ c = config.Config(stream=sys.stdout,
+ env=os.environ,
+ verbosity=3,
+ includeExe=True,
+ traverseNamespace=True,
+ plugins=core.DefaultPluginManager())
+ c.configureWhere(quantum.tests.unit.__path__)
+ sys.exit(run_tests(c))
+
+if __name__ == "__main__":
+ main()
#
PEP8_EXCLUDE="vcsversion.py,*.pyc"
PEP8_OPTIONS="--exclude=$PEP8_EXCLUDE --repeat --show-source"
-PEP8_INCLUDE="bin/* quantum server client common plugins tools run_tests.py setup.py"
+PEP8_INCLUDE="bin/* quantum tools run_tests.py setup.py"
RV=0
run_tests && pep8 $PEP8_OPTIONS $PEP8_INCLUDE || RV=1
+++ /dev/null
-include etc/*
-include etc/init.d/*
+++ /dev/null
-[PLUGIN]
-# Quantum plugin provider module
-provider = quantum.plugins.SamplePlugin.FakePlugin
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-# Copyright 2011 Nicira Networks, Inc.
-# All Rights Reserved.
-#
-# Licensed 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.
-# @author: Somik Behera, Nicira Networks, Inc.
-try:
- __import__('pkg_resources').declare_namespace(__name__)
-except ImportError:
- from pkgutil import extend_path
- __path__ = extend_path(__path__, __name__)
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 OpenStack LLC.
-# All Rights Reserved.
-#
-# Licensed 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.
-
-import logging
-logging.basicConfig()
ROOT = path.abspath(path.dirname(__file__))
CONFIG_PATH = path.abspath('/etc/quantum')
BASE_PACKAGES = ['common', 'server', 'client']
-PLUGINS = ['plugins/sample-plugin', 'plugins/cisco-plugin',
- 'plugins/openvswitch-plugin']
+PLUGINS = ['sample_plugin', 'openvswitch_plugin', 'cisco_plugin']
RELATIVE = False
from setuptools import setup, find_packages
import sys
+import version
Name = 'quantum-cisco-plugin'
ProjecUrl = ""
-Version = '0.1'
+Version = version.get_git_version()
License = 'Apache License 2.0'
-# Change as required
Author = 'Cisco Systems'
AuthorEmail = ''
Maintainer = ''
DataFiles = [
(config_path,
- ['etc/credentials.ini', 'etc/l2network_plugin.ini', 'etc/nexus.ini',
- 'etc/ucs.ini', 'etc/cisco_plugins.ini', 'etc/db_conn.ini'])
+ ['etc/quantum/plugins/cisco/credentials.ini',
+ 'etc/quantum/plugins/cisco/l2network_plugin.ini',
+ 'etc/quantum/plugins/cisco/nexus.ini',
+ 'etc/quantum/plugins/cisco/ucs.ini',
+ 'etc/quantum/plugins/cisco/cisco_plugins.ini',
+ 'etc/quantum/plugins/cisco/db_conn.ini'])
]
setup(
scripts=ProjectScripts,
install_requires=requires,
include_package_data=True,
- packages=find_packages('lib'),
+ packages=["quantum.plugins.cisco"],
package_data=PackageData,
data_files=DataFiles,
- package_dir={'': 'lib'},
eager_resources=EagerResources,
- namespace_packages=['quantum'],
- entry_points={
- 'console_scripts': [
- 'quantum-cisco-tests = quantum.plugins.cisco.run_tests:main'
- ]
- },
)
use_setuptools()
from setuptools import setup, find_packages
+import version
+
Name = 'quantum-client'
Url = "https://launchpad.net/quantum"
-Version = '2012.1dev'
+Version = version.get_git_version()
License = 'Apache License 2.0'
-# Change as required
Author = 'Netstack'
AuthorEmail = 'netstack@lists.launchpad.net'
Maintainer = ''
license=License,
scripts=ProjectScripts,
install_requires=requires,
- include_package_data=True,
- packages=find_packages('lib'),
+ include_package_data=False,
+ packages=["quantum.client"],
package_data=PackageData,
- package_dir={'': 'lib'},
eager_resources=EagerResources,
- namespace_packages=['quantum'],
entry_points={
'console_scripts': [
'quantum = quantum.cli:main'
use_setuptools()
from setuptools import setup, find_packages
+import version
+
Name = 'quantum-common'
Url = "https://launchpad.net/quantum"
-Version = '2012.1dev'
+Version = version.get_git_version()
License = 'Apache License 2.0'
-# Change as required
Author = 'Netstack'
AuthorEmail = 'netstack@lists.launchpad.net'
Maintainer = ''
PackageData = {
}
+exclude = ['quantum.client', 'quantum.client.*', 'quantum.server',
+ 'quantum.server.*', 'quantum.tests', 'quantum.tests.*',
+ 'quantum.plugins.*']
+pkgs = find_packages('.', exclude=exclude)
+pkgs = filter(lambda x: x.startswith("quantum"), pkgs)
setup(
name=Name,
license=License,
scripts=ProjectScripts,
install_requires=requires,
- include_package_data=True,
- packages=find_packages('lib'),
+ include_package_data=False,
+ packages=pkgs,
package_data=PackageData,
- package_dir={'': 'lib'},
eager_resources=EagerResources,
- namespace_packages=['quantum'],
- entry_points={
- 'console_scripts': [
- 'quantum-tests = quantum.run_tests:main'
- ]
- },
+ entry_points={},
)
use_setuptools()
from setuptools import setup, find_packages
+import version
+
import sys
Name = 'quantum-openvswitch-plugin'
ProjecUrl = ""
-Version = '0.1'
+Version = version.get_git_version()
License = 'Apache License 2.0'
-# Change as required
Author = 'Open vSwitch Team'
AuthorEmail = 'discuss@openvswitch.org'
Maintainer = ''
DataFiles = [
(config_path,
- ['etc/ovs_quantum_plugin.ini'])
+ ['etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini'])
]
setup(
scripts=ProjectScripts,
install_requires=requires,
include_package_data=True,
- packages=find_packages('lib'),
+ packages=["quantum.plugins.openvswitch"],
package_data=PackageData,
data_files=DataFiles,
- package_dir={'': 'lib'},
eager_resources=EagerResources,
- namespace_packages=['quantum'],
)
use_setuptools()
from setuptools import setup, find_packages
-Name = 'quantum'
+import version
+import sys
+
+Name = 'quantum-sample-plugin'
+Summary = 'Sample plugin for Quantum'
Url = "https://launchpad.net/quantum"
-Version = '2012.1dev'
+Version = version.get_git_version()
License = 'Apache License 2.0'
Author = 'Netstack'
AuthorEmail = 'netstack@lists.launchpad.net'
Maintainer = ''
-Summary = 'Layer 2 network as a service for Openstack'
ShortDescription = Summary
Description = Summary
requires = [
'quantum-common',
- 'quantum-client',
- 'quantum-server'
+ 'quantum-server',
]
EagerResources = [
PackageData = {
}
-
setup(
name=Name,
version=Version,
- url=Url,
author=Author,
author_email=AuthorEmail,
description=ShortDescription,
scripts=ProjectScripts,
install_requires=requires,
include_package_data=True,
+ packages=["quantum.plugins.sample"],
package_data=PackageData,
+ eager_resources=EagerResources,
)
import os
import sys
+import version
Name = 'quantum-server'
Url = "https://launchpad.net/quantum"
-Version = '2012.1dev'
+Version = version.get_git_version()
License = 'Apache License 2.0'
Author = 'Netstatck'
AuthorEmail = 'netstack@lists.launchpad.net'
# If we're installing server-wide, use an aboslute path for config
# if not, use a relative path
-config_path = '/etc/quantum/'
+config_path = '/etc/quantum'
init_path = '/etc/init.d'
relative_locations = ['--user', '--virtualenv', '--venv']
config_path = 'etc/quantum/'
init_path = 'etc/init.d'
+import os
+from distutils.command.build_py import build_py as _build_py
+
+class build_py(_build_py):
+ def find_data_files(self, package, src_dir):
+ files = []
+ for p in _build_py.find_data_files(self, package, src_dir):
+ if os.path.isdir(p):
+ files.extend(os.path.join(par,f)
+ for par,dirs,files in os.walk(p)
+ for f in files)
+ else:
+ files.append(p)
+ return files
+
+print "config_path: %s" % config_path
DataFiles = [
(config_path,
['etc/quantum.conf', 'etc/quantum.conf.sample',
scripts=ProjectScripts,
install_requires=requires,
include_package_data=True,
- packages=find_packages('lib'),
+ packages=["quantum.server"],
package_data=PackageData,
data_files=DataFiles,
- package_dir={'': 'lib'},
+ package_dir={'quantum': 'quantum'},
eager_resources=EagerResources,
- namespace_packages=['quantum'],
entry_points={
'console_scripts': [
'quantum-server = quantum.server:main'
fi
fi
-ls $@/dist/*.rpm >/dev/null 2>&1
+ls dist/*.rpm >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "You must build rpms before building debian packages"
exit 1
fi
-cd $@
-if [ $? -ne 0 ]; then
- echo "Directory $@ doesn't exist -- what do you want me to build?"
- exit 1
-fi
$FAKEROOT $ALIEN -c -v -d dist/*.noarch.rpm
#!/bin/bash
-cd $@ && python setup.py bdist_rpm
+python setup_$@.py bdist_rpm
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 Cisco Systems
-# All Rights Reserved.
-#
-# Licensed 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.
-# @author: Tyler Smith, Cisco Systems
-import os
-import sys
-
-# To run from the source code, we need to add the various packages
-# to our path so we can find all of the modules correctly
-packages = ['common', 'server', 'client']
-plugins = ["plugins/%s" % p for p in
- os.listdir(os.path.join(os.getcwd(), 'plugins'))]
-
-for project in packages + plugins:
- sys.path.insert(0, os.path.join(os.getcwd(), project, 'lib'))
+++ /dev/null
-# vim: tabstop=4 shiftwidth=4 softtabstop=4
-
-# Copyright 2011 Cisco Systems
-# All Rights Reserved.
-#
-# Licensed 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.
-# @author: Tyler Smith, Cisco Systems
-import os
-import sys
-
-# To run from the source code, we need to add the various packages
-# to our path so we can find all of the modules correctly
-packages = ['common', 'server', 'client']
-
-for project in packages + ["plugins/sample-plugin"]:
- sys.path.insert(0, os.path.join(os.getcwd(), project, 'lib'))
--- /dev/null
+# -*- coding: utf-8 -*-
+# Author: Douglas Creager <dcreager@dcreager.net>
+# This file is placed into the public domain.
+
+# Calculates the current version number. If possible, this is the
+# output of “git describe”, modified to conform to the versioning
+# scheme that setuptools uses. If “git describe” returns an error
+# (most likely because we're in an unpacked copy of a release tarball,
+# rather than in a git working copy), then we fall back on reading the
+# contents of the RELEASE-VERSION file.
+#
+# To use this script, simply import it your setup.py file, and use the
+# results of get_git_version() as your package version:
+#
+# from version import *
+#
+# setup(
+# version=get_git_version(),
+# .
+# .
+# .
+# )
+#
+# This will automatically update the RELEASE-VERSION file, if
+# necessary. Note that the RELEASE-VERSION file should *not* be
+# checked into git; please add it to your top-level .gitignore file.
+#
+# You'll probably want to distribute the RELEASE-VERSION file in your
+# sdist tarballs; to do this, just create a MANIFEST.in file that
+# contains the following line:
+#
+# include RELEASE-VERSION
+
+__all__ = ("get_git_version")
+
+from subprocess import Popen, PIPE
+
+FALLBACK_VERSION="2012.1dev"
+
+def call_git_describe(abbrev=4):
+ try:
+ p = Popen(['git', 'describe', '--abbrev=%d' % abbrev],
+ stdout=PIPE, stderr=PIPE)
+ p.stderr.close()
+ line = p.stdout.readlines()[0]
+ return line.strip()
+ except:
+ return FALLBACK_VERSION
+
+
+def read_release_version():
+ try:
+ f = open("RELEASE-VERSION", "r")
+
+ try:
+ version = f.readlines()[0]
+ return version.strip()
+
+ finally:
+ f.close()
+
+ except:
+ return None
+
+
+def write_release_version(version):
+ f = open("RELEASE-VERSION", "w")
+ f.write("%s\n" % version)
+ f.close()
+
+
+def get_git_version(abbrev=4):
+ # Read in the version that's currently in RELEASE-VERSION.
+
+ release_version = read_release_version()
+
+ # First try to get the current version using “git describe”.
+
+ version = call_git_describe(abbrev)
+
+ # If that doesn't work, fall back on the value that's in
+ # RELEASE-VERSION.
+
+ if version is None:
+ version = release_version
+
+ # If we still don't have anything, that's an error.
+
+ if version is None:
+ raise ValueError("Cannot find the version number!")
+
+ # If the current version is different from what's in the
+ # RELEASE-VERSION file, update the file to be current.
+
+ if version != release_version:
+ write_release_version(version)
+
+ # Finally, return the current version.
+
+ return version
+
+
+if __name__ == "__main__":
+ print get_git_version()