Introduce dosetup.py script, which is similar to setup.py but accepts an additional positional option to specify the name of package to process. eg. python ./dosetup.py ryu-base install --user
The full list of available packages is found in dosetup.py script. 'ryu' is now a meta-package which requires all of the sub-packages. "python ./setup.py $@" is now an alias of "python ./dosetup.py ryu $@". Signed-off-by: YAMAMOTO Takashi <[email protected]> --- MANIFEST.in | 10 ++-- dosetup.py | 159 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ryu/__init__.py | 2 + setup.cfg | 13 ----- setup.py | 14 +---- 5 files changed, 168 insertions(+), 30 deletions(-) create mode 100644 dosetup.py diff --git a/MANIFEST.in b/MANIFEST.in index d582ea8..07380b0 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,10 +1,10 @@ include LICENSE include MANIFEST.in -include *.rst -recursive-include ryu *.xsd -graft doc -graft etc -graft tools +#include *.rst +#recursive-include ryu *.xsd +#graft doc +#graft etc +#graft tools recursive-exclude doc/build * recursive-exclude ryu/tests/packet_data_generator * global-exclude *~ diff --git a/dosetup.py b/dosetup.py new file mode 100644 index 0000000..820fe96 --- /dev/null +++ b/dosetup.py @@ -0,0 +1,159 @@ +# Copyright (C) 2011-2015 Nippon Telegraph and Telephone Corporation. +# Copyright (C) 2011 Isaku Yamahata <yamahata at valinux co jp> +# Copyright (C) 2013-2015 YAMAMOTO Takashi <yamamoto at valinux co jp> +# +# 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. + +# a bug workaround. http://bugs.python.org/issue15881 +try: + import multiprocessing +except ImportError: + pass + +import itertools +import sys + +import setuptools + +import ryu +import ryu.hooks + + +def subpackages(dirs): + dirs = itertools.chain.from_iterable([(x, x + '.*') for x in dirs]) + return setuptools.find_packages(include=dirs) + + +packages = { + 'ryu-base': { + 'packages': [ + 'ryu', + 'ryu.base', + # REVISIT(yamamoto): controller package has a lot of + # openflow specific stuff + 'ryu.controller', + 'ryu.lib', + 'ryu.contrib', + 'ryu.contrib._eventlet', + # REVISIT(yamamoto): probably ovsdb stuff ought to be separated + 'ryu.contrib.ovs', + ] + subpackages([ + 'ryu.contrib.tinyrpc', # used by wsgi + ]), + }, + 'ryu-lib-packet': { + 'packages': [ + 'ryu.lib.packet', + ], + 'install_requires': [ + 'ryu-base==%s' % ryu.version, + ], + }, + 'ryu-lib-netconf': { + 'packages': [ + 'ryu.contrib.ncclient', + 'ryu.lib.netconf', + 'ryu.lib.of_config', + ], + 'install_requires': [ + 'ryu-base==%s' % ryu.version, + 'lxml', + 'paramiko', + ], + }, + # REVISIT(yamamoto): ryu.app package is a mess. + # note that ryu.app.wsgi is used by app_manager. + 'ryu-app': { + 'packages': [ + 'ryu.app', + 'ryu.app.gui_topology', + ], + 'install_requires': [ + 'ryu-base==%s' % ryu.version, + ], + }, + 'ryu-app-topology': { + 'packages': [ + 'ryu.topology', + ], + 'install_requires': [ + 'ryu-ofproto==%s' % ryu.version, + ], + }, + 'ryu-app-ofctl': { + 'packages': [ + 'ryu.app.ofctl', + ], + 'install_requires': [ + 'ryu-ofproto==%s' % ryu.version, + ], + }, + 'ryu-bin': { + 'packages': [ + 'ryu.cmd', + ], + 'entry_points': { + 'console_scripts': [ + 'ryu-manager = ryu.cmd.manager:main', + 'ryu = ryu.cmd.ryu_base:main', + ] + }, + 'files': { + 'data_files': [ + 'etc/ryu = etc/ryu/ryu.conf', + ] + }, + 'install_requires': [ + 'ryu-base==%s' % ryu.version, + ], + }, + 'ryu-ofproto': { + 'packages': [ + 'ryu.ofproto', + 'ryu.topology', + ], + 'install_requires': [ + 'ryu-base==%s' % ryu.version, + ], + }, + 'ryu-services': { + 'packages': subpackages(['ryu.services']), + 'install_requires': [ + 'ryu-base==%s' % ryu.version, + 'paramiko', + ], + }, +} + +packages['ryu'] = { + 'install_requires': ['%s==%s' % (p, ryu.version) for p in packages.keys()] +} + + +def dosetup(target): + kwargs = packages[target] + ryu.hooks.save_orig() + setuptools.setup(name=target, + version=ryu.version, + setup_requires=['d2to1'], d2to1=True, + **kwargs) + sys.exit(0) + + +if __name__ == '__main__': + if len(sys.argv) < 2: + sys.exit(1) + target = sys.argv.pop(1) + dosetup(target) + sys.exit(0) diff --git a/ryu/__init__.py b/ryu/__init__.py index 9c87243..40e2228 100644 --- a/ryu/__init__.py +++ b/ryu/__init__.py @@ -16,3 +16,5 @@ version_info = (3, 18) version = '.'.join(map(str, version_info)) + +#__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup.cfg b/setup.cfg index 6520daa..ff30434 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,4 @@ [metadata] -name = ryu summary = Component-based Software-defined Networking Framework license = Apache License 2.0 author = Ryu project team @@ -19,13 +18,6 @@ keywords = openvswitch openstack -[files] -packages = - ryu -data_files = - etc/ryu = - etc/ryu/ryu.conf - [build_sphinx] all_files = 1 build-dir = doc/build @@ -44,8 +36,3 @@ doc_files = LICENSE [global] setup-hooks = ryu.hooks.setup_hook - -[entry_points] -console_scripts = - ryu-manager = ryu.cmd.manager:main - ryu = ryu.cmd.ryu_base:main diff --git a/setup.py b/setup.py index cf2a404..3e25ca3 100644 --- a/setup.py +++ b/setup.py @@ -14,17 +14,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# a bug workaround. http://bugs.python.org/issue15881 -try: - import multiprocessing -except ImportError: - pass +import dosetup -import setuptools -import ryu.hooks - -ryu.hooks.save_orig() -setuptools.setup(name='ryu', - setup_requires=['pbr'], - pbr=True) +dosetup.dosetup('ryu') -- 2.1.0 ------------------------------------------------------------------------------ Dive into the World of Parallel Programming. The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net/ _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
