diff --git a/Init.py b/Init.py index 6a4b9b6..12f423f 100644 --- a/Init.py +++ b/Init.py @@ -1,2 +1,36 @@ """FreeCAD init script of the CadQuery module""" # (c) 2014-2018 Jeremy Wright Apache 2.0 License +import os +import sys +try: + from . import module_locator +except: + import module_locator + +# Set up so that we can import from our embedded packages +module_base_path = module_locator.module_path() +libs_dir_path = os.path.join(module_base_path, 'Libs') +sys.path.insert(0, libs_dir_path) + +# Tack on our CadQuery library git subtree +cq_lib_path = os.path.join(libs_dir_path, 'cadquery') +sys.path.insert(1, cq_lib_path) + +# Add our third party libraries so that they can be used in scripts +third_party_path = os.path.join(module_base_path, 'ThirdParty') +sys.path.append(third_party_path) + +# Make sure we get the right libs under the FreeCAD installation +fc_base_path = os.path.dirname(os.path.dirname(module_base_path)) +fc_lib_path = os.path.join(fc_base_path, 'lib') +fc_bin_path = os.path.join(fc_base_path, 'bin') + +# Make sure that the directories exist before we add them to sys.path +# This could cause problems or solve them by overriding what CQ is setting for the paths +if os.path.exists(fc_lib_path): + sys.path.insert(1, fc_lib_path) +if os.path.exists(fc_bin_path): + sys.path.insert(1, fc_bin_path) + +# Need to set this for PyQode +os.environ['QT_API'] = 'pyside' diff --git a/InitGui.py b/InitGui.py index 2575150..6435a86 100644 --- a/InitGui.py +++ b/InitGui.py @@ -1,6 +1,6 @@ """CadQuery GUI init module for FreeCAD This adds a workbench with a scripting editor to FreeCAD's GUI.""" -# (c) 2014-2016 Jeremy Wright Apache 2.0 License +# (c) 2014-2018 Jeremy Wright Apache 2.0 License import FreeCAD, FreeCADGui try: from CadQuery.CQGui.Command import * @@ -8,41 +8,6 @@ except: from CQGui.Command import * import CadQuery_rc -import os -import sys -try: - from . import module_locator -except: - import module_locator - -# Set up so that we can import from our embedded packages -module_base_path = module_locator.module_path() -libs_dir_path = os.path.join(module_base_path, 'Libs') -sys.path.insert(0, libs_dir_path) - -# Tack on our CadQuery library git subtree -cq_lib_path = os.path.join(libs_dir_path, 'cadquery') -sys.path.insert(1, cq_lib_path) - -# Add our third party libraries so that they can be used in scripts -third_party_path = os.path.join(module_base_path, 'ThirdParty') -sys.path.append(third_party_path) - -# Make sure we get the right libs under the FreeCAD installation -fc_base_path = os.path.dirname(os.path.dirname(module_base_path)) -fc_lib_path = os.path.join(fc_base_path, 'lib') -fc_bin_path = os.path.join(fc_base_path, 'bin') - -# Make sure that the directories exist before we add them to sys.path -# This could cause problems or solve them by overriding what CQ is setting for the paths -if os.path.exists(fc_lib_path): - sys.path.insert(1, fc_lib_path) -if os.path.exists(fc_bin_path): - sys.path.insert(1, fc_bin_path) - -# Need to set this for PyQode -os.environ['QT_API'] = 'pyside' - class CadQueryWorkbench (Workbench): """CadQuery workbench for FreeCAD""" """CadQuery workbench for FreeCAD""" diff --git a/Libs/cadquery/Dockerfile b/Libs/cadquery/Dockerfile index 1d2b9ba..de88a69 100644 --- a/Libs/cadquery/Dockerfile +++ b/Libs/cadquery/Dockerfile @@ -12,9 +12,9 @@ RUN apt-get update --fix-missing && apt-get install -y wget bzip2 ca-certificate git mercurial subversion RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && \ - wget --quiet https://repo.continuum.io/archive/Anaconda2-5.0.0-Linux-x86_64.sh -O ~/anaconda.sh && \ - /bin/bash ~/anaconda.sh -b -p /opt/conda && \ - rm ~/anaconda.sh + wget --quiet https://repo.continuum.io/miniconda/Miniconda2-latest-Linux-x86_64.sh -O ~/miniconda.sh && \ + /bin/bash ~/miniconda.sh -b -p /opt/conda && \ + rm ~/miniconda.sh RUN apt-get install -y curl grep sed dpkg && \ TINI_VERSION=`curl https://github.com/krallin/tini/releases/latest | grep -o "/v.*\"" | sed 's:^..\(.*\).$:\1:'` && \ @@ -42,6 +42,10 @@ COPY tests $CQ_HOME/tests RUN pip install -r /opt/cadquery/requirements-dev.txt RUN cd $CQ_HOME && python ./setup.py install +RUN pip install cqparts +RUN pip install cqparts-bearings +RUN pip install cqparts-fasteners +RUN pip install cqparts-misc RUN chmod +x $CQ_HOME/cq_cmd.sh RUN useradd -ms /bin/bash cq USER cq diff --git a/Libs/cadquery/build_docker.sh b/Libs/cadquery/build_docker.sh old mode 100644 new mode 100755