forked from wil3/gymfc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
58 lines (50 loc) · 2.04 KB
/
setup.py
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
from setuptools import setup, find_packages
from distutils.command.build import build as DistutilsBuild
import subprocess
import os
import sys
class CustomBuild(DistutilsBuild):
def check_cmake_installed(self):
output = subprocess.getoutput("cmake --version")
words = output.split()
if (len(words) > 2 and
words[0] == "cmake" and
words[1] == "version"):
version_str = words[2]
print ("Found cmake version ", version_str)
version = list(map(int, version_str.split(".")))
# According to the CMakeList this needs to be >=2.6
if ((version[0] == 2 and version[1] >= 6) or version[0] >= 3):
return True
return False
def build_plugin(self):
plugin_dir = os.path.join(os.path.dirname(__file__), "gymfc/envs/assets/gazebo/plugins")
print ("Plugin dir", plugin_dir)
build_plugin_script = "./build_plugin.sh"
p = subprocess.call([build_plugin_script], cwd=plugin_dir, shell=True)
print ("Done building plugin")
def run(self):
if self.check_cmake_installed():
print ("Running custom install")
self.build_plugin()
DistutilsBuild.run(self)
else:
raise Exception("Cannot find valid cmake installation, required version >= 2.6.")
setup(name='gymfc',
version='0.1.2',
description='Environment for developing intelligent flight control systems',
author='William Koch',
author_email='wfkoch [at] bu [dot] edu',
url='https://github.com/wil3/gymfc',
license='MIT',
packages=find_packages(),
package_data={'gymfc': [
"envs/assets/gazebo/models/quadcopter_attitude_control/*.config",
"envs/assets/gazebo/models/quadcopter_attitude_control/*.sdf",
"envs/assets/gazebo/worlds/*.world",
"envs/assets/gazebo/plugins/build/*.so"
]},
include_package_data=True,
cmdclass={'build': CustomBuild},
install_requires=['gym', 'numpy', 'psutil'],
)