| #!/usr/bin/env python3 | |
| # | |
| # Licensed to the Apache Software Foundation (ASF) under one | |
| # or more contributor license agreements. See the NOTICE file | |
| # distributed with this work for additional information | |
| # regarding copyright ownership. The ASF licenses this file | |
| # to you 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. | |
| # | |
| from distutils.core import setup | |
| from distutils.command.build_py import build_py | |
| from distutils.file_util import copy_file | |
| from os.path import join | |
| from os import environ | |
| """Install public packages and scripts for Qpid Dispatch.""" | |
| class BuildPy(build_py): | |
| """Extend standard build command, add generated modules from binary directory.""" | |
| MODULES = ['qpid_dispatch_site.py'] | |
| def run(self): | |
| build_py.run(self) # Run the standard build, copies source .py files into builddir | |
| for m in self.MODULES: | |
| copy_file(join('${CMAKE_CURRENT_BINARY_DIR}', m), join(self.build_lib, m)) | |
| def get_outputs(self, **kwargs): | |
| return build_py.get_outputs(self, **kwargs) + [join(self.build_lib, m) for m in self.MODULES] | |
| options = {} | |
| destdir = environ.get("DESTDIR") | |
| if destdir: | |
| options["install"] = {"root": destdir} | |
| setup( | |
| options=options, | |
| name='qpid_dispatch', | |
| description='Apache Qpid Dispatch tools and libraries.', | |
| package_dir={'' : '${CMAKE_SOURCE_DIR}/python'}, | |
| packages=['qpid_dispatch', 'qpid_dispatch.management'], | |
| package_data={'qpid_dispatch.management': ['*.json']}, | |
| cmdclass={'build_py': BuildPy}, | |
| version='${QPID_DISPATCH_VERSION}', | |
| author='Apache Qpid', | |
| author_email='dev@qpid.apache.org', | |
| url='http://qpid.apache.org/', | |
| license='Apache Software License' | |
| ) |