Second round of packaging changes

This change condenses the directory structure to something more similar to
what we had before while producing similar packages.

It also introduces version.py which allows us to get the version from git tags
(or a fallback version if not available).

Fixes lp bug 889336
Fixes lp bug 888795

Change-Id: I86136bd9dbabb5eb1f8366ed665ed9b54f695124
This commit is contained in:
Brad Hall 2011-11-09 22:57:13 -08:00
parent 0a9faf33f7
commit 6a08320031
182 changed files with 268 additions and 463 deletions

5
MANIFEST.in Normal file
View File

@ -0,0 +1,5 @@
include etc/*
include etc/init.d/*
include etc/quantum/plugins/openvswitch/*
include etc/quantum/plugins/cisco/*
include version.py

View File

@ -16,16 +16,9 @@
# 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()

View File

@ -16,15 +16,9 @@
# 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()

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,38 +0,0 @@
# 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

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,67 +0,0 @@
#!/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()

3
etc/plugins.ini Normal file
View File

@ -0,0 +1,3 @@
[PLUGIN]
# Quantum plugin provider module
provider = quantum.plugins.sample.SamplePlugin.FakePlugin

View File

@ -1 +0,0 @@
include etc/*

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,23 +0,0 @@
# 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__)

View File

@ -1 +0,0 @@
include etc/*

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,5 +0,0 @@
try:
__import__('pkg_resources').declare_namespace(__name__)
except ImportError:
from pkgutil import extend_path
__path__ = extend_path(__path__, __name__)

View File

@ -1,55 +0,0 @@
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'],
)

View File

@ -36,7 +36,7 @@ if os.path.exists(os.path.join(possible_topdir, 'quantum', '__init__.py')):
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

View File

@ -26,7 +26,7 @@ import os
import sys
FORMAT = "json"
LOG = logging.getLogger('quantum.cli_lib')
LOG = logging.getLogger('quantum.client.cli_lib')
class OutputTemplate(object):

View File

@ -283,5 +283,5 @@ def run_tests(c=None):
# 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",
}

View File

@ -36,8 +36,7 @@ import subprocess
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,

Some files were not shown because too many files have changed in this diff Show More