Fixed python2/3 compatiblities
This commit is contained in:
parent
8547f5884c
commit
cf43039dae
1 changed files with 11 additions and 5 deletions
|
@ -1,12 +1,18 @@
|
|||
import os
|
||||
import platform
|
||||
import os, platform
|
||||
import distro
|
||||
|
||||
FREECAD_PATH = ''
|
||||
|
||||
# check os types to search for freecad libraries
|
||||
if 'linux' in platform.system().lower():
|
||||
if 'ubuntu' in platform.dist()[0].lower():
|
||||
dist = distro.linux_distribution(full_distribution_name=False)[0].lower()
|
||||
# TODO: check freecad libs on different distros
|
||||
if dist in ['ubuntu', 'debian', 'fedora', 'arch']:
|
||||
FREECAD_PATH = '/usr/lib/freecad'
|
||||
elif 'fedora' in platform.dist()[0].lower():
|
||||
else:
|
||||
# fallback to default path
|
||||
FREECAD_PATH = '/usr/lib/freecad'
|
||||
print(dist, FREECAD_PATH)
|
||||
elif 'nt' in platform.dist().lower():
|
||||
pass
|
||||
# TODO: Find freecad libs on windows
|
||||
|
@ -14,7 +20,7 @@ else:
|
|||
raise Exception("Platform not supported")
|
||||
|
||||
# Extend sys.path to include freecad python libraries (including workbenches)
|
||||
os.sys.path.extend(os.path.join(FREECAD_PATH, d) for d in os.scandir(FREECAD_PATH))
|
||||
os.sys.path.extend(os.path.join(FREECAD_PATH, d) for d in os.listdir(FREECAD_PATH))
|
||||
|
||||
from freecad_to_gazebo.mesh_exporter import export
|
||||
from freecad_to_gazebo.model import *
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue