changed freecad libs searching to hard-coded per platform
This commit is contained in:
parent
d8aa4eb76e
commit
251d79e9f8
1 changed files with 10 additions and 19 deletions
|
@ -1,32 +1,23 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import platform
|
||||||
|
|
||||||
# check os types to search for freecad libraries
|
# check os types to search for freecad libraries
|
||||||
if 'posix' in os.name:
|
if 'linux' in platform.system().lower():
|
||||||
# TODO: Test the result of os.name in different systems
|
if 'ubuntu' in platform.dist().lower():
|
||||||
_so = os.popen('which freecad')
|
FREECAD_PATH = '/usr/lib/freecad'
|
||||||
FREECAD_PATH = _so.readline().replace('\n', '')
|
elif 'fedora' in platform.dist().lower():
|
||||||
if not FREECAD_PATH:
|
FREECAD_PATH = '/usr/lib/freecad'
|
||||||
_so.close()
|
elif 'nt' in platform.dist().lower():
|
||||||
_so = os.popen('which FreeCAD')
|
|
||||||
FREECAD_PATH = _so.readline().replace('\n', '')
|
|
||||||
_so.close()
|
|
||||||
|
|
||||||
FREECAD_PATH = FREECAD_PATH.replace('bin', 'lib')
|
|
||||||
|
|
||||||
if not FREECAD_PATH:
|
|
||||||
raise ModuleNotFoundError('FreeCAD not installed.')
|
|
||||||
|
|
||||||
elif 'nt' in os.name:
|
|
||||||
# TODO: Find freecad libs on windows
|
# TODO: Find freecad libs on windows
|
||||||
pass
|
|
||||||
else:
|
else:
|
||||||
raise Exception("Platform not supported")
|
raise Exception("Platform not supported")
|
||||||
|
|
||||||
# Extend sys.path to include freecad python libraries (including workbenches)
|
# Extend sys.path to include freecad python libraries (including workbenches)
|
||||||
os.sys.path.extend(d.path for d in os.scandir(FREECAD_PATH))
|
os.sys.path.extend(d.path for d in os.scandir(FREECAD_PATH))
|
||||||
|
|
||||||
from .exporter import export
|
from freecad_to_gazebo.mesh_exporter import export
|
||||||
from .model import *
|
from freecad_to_gazebo.model import *
|
||||||
|
from freecad_to_gazebo.freecad_exporter import *
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue