forked from vvb/UcsPythonSDK
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·62 lines (54 loc) · 1.85 KB
/
setup.py
File metadata and controls
executable file
·62 lines (54 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/python
import sys
import os
from setuptools import setup
from setuptools.command.install import install as _install
from setuptools.command.easy_install import chmod, current_umask
from distutils import log
if sys.version_info < (2, 4) or sys.version_info[0] == 3:
raise DistutilsError("This package requires Python 2.4 or higher versions 2.x not Python3")
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)),r"src/UcsSdk"))
from Version import __version__
name='UcsSdk'
files = ["UcsConfig.cfg", "resources/SyncMoConfig.xml"]
in_place_scripts = ["UcsHandle.py", "UcsHandle_Edit.py", "WatchUcsGui.py", "UcsHandle.py", "CcoImage.py", "ConvertFromBackup.py"]
def is_package(path):
return (
os.path.isdir(path) and
os.path.isfile(os.path.join(path, '__init__.py'))
)
def find_packages(path, base="" ):
packages = {}
for item in os.listdir(path):
dir = os.path.join(path, item)
if is_package( dir ):
if base:
module_name = "%(base)s.%(item)s" % vars()
else:
module_name = item
packages[module_name] = dir
packages.update(find_packages(dir, module_name))
return packages
class install(_install):
def run(self):
_install.run(self)
# set the execute bit on scripts that are NOT copied to a bin dir
for in_place_script in in_place_scripts:
if os.name == 'posix' and not self.dry_run:
target = os.path.join(self.install_lib, name, in_place_script)
log.info("Set execute bit on: "+ target)
chmod(target, 0o777 - current_umask())
setup(
name=name,
version=__version__,
description='Python SDK for Cisco UCS Manager',
author='Cisco Systems',
author_email='',
long_description='Install Instructions: sudo python setup.py install',
license='LICENSE.txt',
cmdclass={'install': install},
packages=find_packages('src'),
package_dir = {'': 'src'},
include_package_data = True,
zip_safe = False,
)