use d2to1 and pbr for packaging
- distutils2-like setup.cfg files for a package's metadata - avoid absolute '/etc/ryu/' path for our config file Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
f7219a77df
commit
193a0496c1
|
@ -53,7 +53,11 @@ CONF.register_cli_opts([
|
|||
|
||||
|
||||
def main():
|
||||
CONF(project='ryu', version='ryu-manager %s' % version)
|
||||
try:
|
||||
CONF(project='ryu', version='ryu-manager %s' % version,
|
||||
default_config_files=['/usr/local/etc/ryu/ryu.conf'])
|
||||
except cfg.ConfigFilesNotFoundError:
|
||||
CONF(project='ryu', version='ryu-manager %s' % version)
|
||||
|
||||
log.init_log()
|
||||
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
||||
|
||||
# Copyright 2013 Hewlett-Packard Development Company, L.P.
|
||||
# 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 sys
|
||||
from ryu import version
|
||||
|
||||
|
||||
def setup_hook(config):
|
||||
"""Filter config parsed from a setup.cfg to inject our defaults."""
|
||||
metadata = config['metadata']
|
||||
if sys.platform == 'win32':
|
||||
requires = metadata.get('requires_dist', list()).split('\n')
|
||||
requires.append('pywin32')
|
||||
requires.append('wmi')
|
||||
requires.remove('pyudev')
|
||||
metadata['requires_dist'] = "\n".join(requires)
|
||||
config['metadata'] = metadata
|
||||
|
||||
metadata['version'] = str(version)
|
35
setup.cfg
35
setup.cfg
|
@ -1,3 +1,33 @@
|
|||
[metadata]
|
||||
name = ryu
|
||||
summary = Component-based Software-defined Networking Framework
|
||||
license = Apache License 2.0
|
||||
author = Ryu project team
|
||||
author-email = ryu-devel@lists.sourceforge.net
|
||||
home-page = http://osrg.github.io/ryu/
|
||||
description-file = README.rst
|
||||
platform = any
|
||||
classifier =
|
||||
Development Status :: 5 - Production/Stable
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Topic :: System :: Networking
|
||||
Natural Language :: English
|
||||
Programming Language :: Python
|
||||
Operating System :: Unix
|
||||
keywords =
|
||||
openflow
|
||||
openvswitch
|
||||
openstack
|
||||
|
||||
[files]
|
||||
packages =
|
||||
ryu
|
||||
data_files =
|
||||
etc/ryu =
|
||||
etc/ryu/ryu.conf
|
||||
scripts =
|
||||
bin/ryu-manager
|
||||
|
||||
[build_sphinx]
|
||||
all_files = 1
|
||||
build-dir = doc/build
|
||||
|
@ -12,3 +42,8 @@ doc_files = LICENSE
|
|||
README.rst
|
||||
SubmittingPatches.rst
|
||||
doc/
|
||||
|
||||
[global]
|
||||
setup-hooks =
|
||||
pbr.hooks.setup_hook
|
||||
ryu.hooks.setup_hook
|
||||
|
|
51
setup.py
51
setup.py
|
@ -14,52 +14,9 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import sys
|
||||
import setuptools
|
||||
|
||||
from setuptools import find_packages
|
||||
from setuptools import setup
|
||||
|
||||
from ryu import version
|
||||
from ryu import utils
|
||||
|
||||
requires = utils.parse_requirements()
|
||||
|
||||
doing_bdist = any(arg.startswith('bdist') for arg in sys.argv[1:])
|
||||
|
||||
long_description = open('README.rst').read() + '\n\n'
|
||||
|
||||
if doing_bdist:
|
||||
start = long_description.find('=\n') + 2
|
||||
long_description = long_description[
|
||||
start:long_description.find('\n\n\n', start)]
|
||||
|
||||
classifiers = [
|
||||
'Development Status :: 5 - Production/Stable',
|
||||
'License :: OSI Approved :: Apache Software License',
|
||||
'Topic :: System :: Networking',
|
||||
'Natural Language :: English',
|
||||
'Programming Language :: Python',
|
||||
'Operating System :: Unix',
|
||||
]
|
||||
|
||||
if sys.platform == 'win32':
|
||||
data_files = [('etc/ryu', ['etc/ryu/ryu.conf'])]
|
||||
else:
|
||||
data_files = [('/etc/ryu', ['etc/ryu/ryu.conf'])]
|
||||
|
||||
setup(name='ryu',
|
||||
version=version,
|
||||
description=("Ryu Network Operating System"),
|
||||
long_description=long_description,
|
||||
classifiers=classifiers,
|
||||
keywords='openflow openvswitch openstack',
|
||||
url='http://osrg.github.io/ryu/',
|
||||
author='Ryu project team',
|
||||
author_email='ryu-devel@lists.sourceforge.net',
|
||||
install_requires=requires,
|
||||
license='Apache License 2.0',
|
||||
packages=find_packages(),
|
||||
scripts=['bin/ryu-manager', ],
|
||||
data_files=data_files,
|
||||
include_package_data=True,
|
||||
)
|
||||
setuptools.setup(name='ryu',
|
||||
setup_requires=['d2to1', 'pbr'],
|
||||
d2to1=True)
|
||||
|
|
Loading…
Reference in New Issue