blob: 32c566f85002a7d0b6144eae31aea7a7351bda73 [file] [log] [blame]
Scott Bakerbcbd4cc2018-03-07 13:50:21 -08001#!/usr/bin/env python
Matteo Scandolod2044a42017-08-07 16:08:28 -07002
3# Copyright 2017-present Open Networking Foundation
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16
Scott Baker96b995a2017-02-15 16:21:12 -080017import os
Scott Bakerbcbd4cc2018-03-07 13:50:21 -080018from setuptools.command.install import install
19
Scott Bakerbcbd4cc2018-03-07 13:50:21 -080020try:
21 from xosutil.autoversion_setup import setup_with_auto_version as setup
22except ImportError:
23 # xosutil is not installed. Expect this to happen when we build an egg, in which case xosgenx.version will
24 # automatically have the right version.
25 from setuptools import setup
26
27from xosapi.version import __version__
Scott Baker96b995a2017-02-15 16:21:12 -080028
Zack Williams045b63d2019-01-22 16:30:57 -070029
Scott Bakerbcbd4cc2018-03-07 13:50:21 -080030class InstallFixChameleonPermissions(install):
Scott Bakerbef5fd92019-02-21 10:24:02 -080031 # Chameleon requires these files have executable permission set,
32 # but setup.py installs them without the execute bit.
Scott Bakerbcbd4cc2018-03-07 13:50:21 -080033 def run(self):
34 install.run(self)
35 for filepath in self.get_outputs():
Zack Williams045b63d2019-01-22 16:30:57 -070036 if filepath.endswith(
Scott Bakerbef5fd92019-02-21 10:24:02 -080037 "chameleon_client/protoc_plugins/gw_gen.py"
38 ):
Zack Williams045b63d2019-01-22 16:30:57 -070039 os.chmod(filepath, 0o777)
Scott Baker96b995a2017-02-15 16:21:12 -080040
Scott Baker96b995a2017-02-15 16:21:12 -080041
Zack Williams045b63d2019-01-22 16:30:57 -070042setup_result = setup(
43 name="xosapi",
44 version=__version__,
45 cmdclass={"install": InstallFixChameleonPermissions},
46 description="XOS api client",
Zack Williams045b63d2019-01-22 16:30:57 -070047 packages=[
Scott Bakerbef5fd92019-02-21 10:24:02 -080048 "xosapi.chameleon_client",
49 "xosapi.chameleon_client.protos",
50 "xosapi.chameleon_client.protoc_plugins",
Zack Williams045b63d2019-01-22 16:30:57 -070051 "xosapi",
52 "xosapi.convenience",
53 ],
Zack Williams045b63d2019-01-22 16:30:57 -070054 scripts=["xossh"],
55)