Skip to content

Commit

Permalink
Multiple minor fixes after the latest big release (#185)
Browse files Browse the repository at this point in the history
  • Loading branch information
openvmp authored Sep 17, 2024
1 parent 9feee11 commit f0d47e5
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 9 deletions.
24 changes: 20 additions & 4 deletions partcad-cli/src/partcad_cli/cli_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,11 @@ def cli_list_sketches(args, ctx):

output = "PartCAD sketches:\n"
for project_name in ctx.projects:
if not args.recursive and args.package != project_name:
if (
not args.recursive
and args.package is not None
and args.package != project_name
):
continue

if (
Expand Down Expand Up @@ -272,7 +276,11 @@ def cli_list_interfaces(args, ctx):

output = "PartCAD interfaces:\n"
for project_name in ctx.projects:
if not args.recursive and args.package != project_name:
if (
not args.recursive
and args.package is not None
and args.package != project_name
):
continue

if (
Expand Down Expand Up @@ -469,7 +477,11 @@ def cli_list_parts(args, ctx):

output = "PartCAD parts:\n"
for project_name in ctx.projects:
if not args.recursive and args.package != project_name:
if (
not args.recursive
and args.package is not None
and args.package != project_name
):
continue

if (
Expand Down Expand Up @@ -539,7 +551,11 @@ def cli_list_assemblies(args, ctx):

output = "PartCAD assemblies:\n"
for project_name in ctx.projects:
if not args.recursive and args.package != project_name:
if (
not args.recursive
and args.package is not None
and args.package != project_name
):
continue

if (
Expand Down
2 changes: 1 addition & 1 deletion partcad/src/partcad/part_factory_build123d.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
# Stay one step ahead of the minimum required Python version
python_version = "3.10"
if python_version == "3.12" or python_version == "3.11":
pc_logging.info(
pc_logging.debug(
"Downgrading Python version to 3.10 to avoid compatibility issues with build123d"
)
python_version = "3.10"
Expand Down
2 changes: 1 addition & 1 deletion partcad/src/partcad/part_factory_cadquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def __init__(
# Stay one step ahead of the minimum required Python version
python_version = "3.10"
if python_version == "3.12" or python_version == "3.11":
pc_logging.info(
pc_logging.debug(
"Downgrading Python version to 3.10 to avoid compatibility issues with CadQuery"
)
python_version = "3.10"
Expand Down
1 change: 1 addition & 0 deletions partcad/src/partcad/part_factory_extrude.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ def __init__(self, ctx, source_project, target_project, config):

async def instantiate(self, part):
with pc_logging.Action("Extrude", part.project_name, part.name):
shape = None
try:
self.sketch = self.project.ctx.get_sketch(
self.source_sketch_spec
Expand Down
2 changes: 1 addition & 1 deletion partcad/src/partcad/runtime_python.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_async_lock(self):
self.tls.async_locks[self_id] = asyncio.Lock()
return self.tls.async_locks[self_id]

async def once(self):
def once(self):
pass

async def run(self, cmd, stdin="", cwd=None):
Expand Down
12 changes: 10 additions & 2 deletions partcad/src/partcad/sketch_factory_build123d.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,11 @@ async def instantiate(self, sketch):
picklestring = pickle.dumps(request)
request_serialized = base64.b64encode(picklestring).decode()

await self.runtime.ensure("build123d")
await self.runtime.ensure("numpy==1.24.1")
await self.runtime.ensure("nptyping==1.24.1")
await self.runtime.ensure("cadquery")
await self.runtime.ensure("ocp-tessellate")
await self.runtime.ensure("build123d")
cwd = self.project.config_dir
if self.cwd is not None:
cwd = os.path.join(self.project.config_dir, self.cwd)
Expand All @@ -104,7 +107,12 @@ async def instantiate(self, sketch):
if len(errors) > 0:
error_lines = errors.split("\n")
for error_line in error_lines:
sketch.error("%s: %s" % (sketch.name, error_line))
error_line = error_line.strip()
if not error_line:
continue
# TODO(clairbee): Move the sketch name concatenation to where the logging happens
# part.error("%s: %s" % (sketch.name, error_line))
sketch.error(error_line)

try:
# pc_logging.error("Response: %s" % response_serialized)
Expand Down

0 comments on commit f0d47e5

Please sign in to comment.