Skip to content

Commit db620fc

Browse files
author
Evan Jones
committed
Merge branch 'master' into feature/type_hints
# Conflicts: # solid/objects.py
2 parents 230ab30 + 50a7d51 commit db620fc

8 files changed

Lines changed: 53 additions & 43 deletions

File tree

‎.circleci/config.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
# https://circleci.com/docs/2.0/circleci-images/
1919
docker:
2020
# - image: circleci/build-image:ubuntu-14.04-XXL-upstart-1189-5614f37
21-
- image: circleci/python:3.6.6-stretch-browsers
21+
- image: circleci/python:3.7.4-stretch-browsers
2222
steps:
2323
- checkout
2424
- run: mkdir -p $CIRCLE_ARTIFACTS $CIRCLE_TEST_REPORTS

‎MANIFEST.in‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎pyproject.toml‎

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[tool.poetry]
2+
name = "solidpython"
3+
version = "0.3.3"
4+
description = "Python interface to the OpenSCAD declarative geometry language"
5+
authors = ["Evan Jones <evan_t_jones@mac.com>"]
6+
url='https://github.com/SolidCode/SolidPython'
7+
license = "LGPL-2.1"
8+
9+
classifiers=[
10+
"Programming Language :: Python",
11+
"Programming Language :: Python :: 3",
12+
"Development Status :: 4 - Beta",
13+
"Environment :: Other Environment",
14+
"Intended Audience :: Developers",
15+
"License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)",
16+
"Operating System :: OS Independent",
17+
"Topic :: Software Development :: Libraries :: Python Modules",
18+
"Topic :: Scientific/Engineering :: Mathematics",
19+
]
20+
packages=[
21+
{ include = "solid"}
22+
]
23+
24+
[tool.poetry.dependencies]
25+
python = "^3.0"
26+
euclid3 = "^0.1.0"
27+
pypng = "^0.0.19"
28+
PrettyTable = "=0.7.2"
29+
regex = "^2019.4"
30+
31+
[tool.poetry.dev-dependencies]
32+
tox = "^tox 3.11"
33+
34+
[build-system]
35+
requires = ["poetry>=0.12"]
36+
build-backend = "poetry.masonry.api"
37+

‎setup.cfg‎

Lines changed: 0 additions & 7 deletions
This file was deleted.

‎setup.py‎

Lines changed: 0 additions & 25 deletions
This file was deleted.

‎solid/objects.py‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -707,17 +707,18 @@ def disable(openscad_obj:OScO) -> OScO:
707707
# --include() makes those methods available AND executes all code in
708708
# scad_file_path.scad, which may have side effects.
709709
# Unless you have a specific need, call use().
710-
def use(scad_file_path:str, use_not_include:bool=True) -> bool:
710+
def use(scad_file_path:str, use_not_include:bool=True, dest_namespace_dict:Dict=None):
711711
'''
712712
Opens scad_file_path, parses it for all usable calls,
713713
and adds them to caller's namespace.
714714
'''
715715
# These functions in solidpython are used here and only here; don't pollute
716716
# the global namespace with them
717-
from .solidpython import extract_callable_signatures
717+
from .solidpython import parse_scad_callables
718718
from .solidpython import new_openscad_class_str
719719
from .solidpython import calling_module
720720

721+
contents = None
721722
try:
722723
with open(scad_file_path) as module:
723724
contents = module.read()
@@ -728,15 +729,17 @@ def use(scad_file_path:str, use_not_include:bool=True) -> bool:
728729
# Once we have a list of all callables and arguments, dynamically
729730
# add OpenSCADObject subclasses for all callables to the calling module's
730731
# namespace.
731-
symbols_dicts = extract_callable_signatures(scad_file_path)
732+
symbols_dicts = parse_scad_callables(contents)
732733

733734
for sd in symbols_dicts:
734735
class_str = new_openscad_class_str(sd['name'], sd['args'], sd['kwargs'],
735736
scad_file_path, use_not_include)
736737
# If this is called from 'include', we have to look deeper in the stack
737738
# to find the right module to add the new class to.
738-
stack_depth = 2 if use_not_include else 3
739-
exec(class_str, calling_module(stack_depth).__dict__)
739+
if dest_namespace_dict is None:
740+
stack_depth = 2 if use_not_include else 3
741+
dest_namespace_dict = calling_module(stack_depth).__dict__
742+
exec(class_str, dest_namespace_dict)
740743

741744
return True
742745

‎solid/solidpython.py‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,9 @@ def parse_scad_callables(scad_code_str:str) -> List[dict]:
195195

196196
# TODO: write a pyparsing grammar for OpenSCAD, or, even better, use the yacc parse grammar
197197
# used by the language itself. -ETJ 06 Feb 2011
198-
198+
199+
# FIXME: OpenSCAD use/import includes top level variables. We should parse
200+
# those out (e.g. x = someValue;) as well -ETJ 21 May 2019
199201
no_comments_re = r'(?mxs)(//.*?\n|/\*.*?\*/)'
200202

201203
# Also note: this accepts: 'module x(arg) =' and 'function y(arg) {', both

‎tox.ini‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# content of: tox.ini , put in same dir as setup.py
22
[tox]
33
# envlist = py27,py36
4-
envlist = py36
4+
skipsdist = True
5+
envlist = py37
56
# formerly included ,pep8
67

78
[testenv]
9+
whitelist_externals = poetry
810
commands=
11+
poetry install -v
912
python solid/test/test_screw_thread.py
1013
python solid/test/test_solidpython.py
1114
python solid/test/test_utils.py

0 commit comments

Comments
 (0)