Skip to content

Commit

Permalink
Modifiy OSR compilation flags to use dashes instead of forward slashes
Browse files Browse the repository at this point in the history
Updated rapidjson-python
Added debug messages for failed ply/objwavefront concatenation
Added debug messages for service manager startup/shutdown
Fixed bug in file serialization where EOF message was being appended to file contents
  • Loading branch information
langmm committed Jul 8, 2024
1 parent 7291af4 commit bbb83c8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 7 deletions.
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1143,16 +1143,22 @@ def running_service_w(service_type, partial_commtype=None,
logger.info(f"Started service manager via {args} ({process_kws})")
try:
cli.wait_for_server()
logger.info("Service manager started")
yield cli
logger.info("Stopping service manager")
cli.stop_server()
assert not cli.is_running
logger.info("Stopped service manager")
p.wait(10)
finally:
if p.returncode is None: # pragma: debug
logger.error("Terminating service manager that is still "
"running after stop_server")
p.terminate()
if with_coverage:
if os.path.isfile(script_path):
os.remove(script_path)
logger.info("Exiting service manager fixture")
return running_service_w


Expand Down
9 changes: 8 additions & 1 deletion yggdrasil/command_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,11 @@ class ygginfo(SubCommand):
(('--fullpath', ),
{'action': 'store_true',
'help': 'Get the full path to the tool exectuable.'}),
(('--gnu-style-flags', ),
{'action': 'store_true',
'help': ('Convert flags to use dashes (-) instead of '
'forward slashes (/) (used only with MSVC '
'compilation tools.')}),
] + DependencySpecialization.command_line_options,
parsers=[
ArgumentParser(
Expand Down Expand Up @@ -695,7 +700,9 @@ def func(cls, args, return_str=False):
dry_run=args.dry_run)
out = ' '.join(flags)
if platform._is_win: # pragma: windows:
if dep.tool(args.tool).toolset != 'msvc':
if ((args.gnu_style_flags
or (dep.tool(args.tool).toolname
not in ['LINK', 'LINK++']))):
out = out.replace('/', '-')
out = out.replace('\\', '/')
elif args.fullpath:
Expand Down
3 changes: 2 additions & 1 deletion yggdrasil/communication/FileComm.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,8 @@ def prepare_message(self, *args, **kwargs):
def serialize(self, obj, **kwargs):
r"""Serialize a message using the associated serializer."""
with self._closing_thread.lock:
if (not self.concats_as_str) and self.is_open and (self.file_tell() != 0):
if (((not self.is_eof(obj)) and (not self.concats_as_str)
and self.is_open and (self.file_tell() != 0))):
new_obj = obj
with open(self.current_address, 'rb') as fd:
old_obj = self.deserialize(fd.read())[0]
Expand Down
8 changes: 5 additions & 3 deletions yggdrasil/drivers/OSRModelDriver.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def compile_dependencies(cls, target='OpenSimRootYgg', toolname=None,
if maxjobs > 1:
flags += [f'-j{maxjobs}']
env = copy.deepcopy(os.environ)
flag_options = ''
if platform._is_win: # pragma: windows
env['YGG_OSR_TOOL'] = toolname
if toolname == 'cl++':
Expand All @@ -179,13 +180,14 @@ def compile_dependencies(cls, target='OpenSimRootYgg', toolname=None,
logger.info(f"OSR compiler: {cl_path}\n"
f"OSR linker: {link_path}")
if cl_path:
paths_to_add = os.pathsep.join(list(set([
paths_to_add = list(set([
os.path.dirname(cl_path),
os.path.dirname(link_path)])))
os.path.dirname(link_path)]))
env['YGG_OSR_CXX'] = os.path.basename(cl_path)
env['YGG_OSR_LINK'] = os.path.basename(link_path)
tools.update_path_env("PATH", paths_to_add,
env=env, add_to_front=True)
flag_options += '--gnu-style-flags '
for k in ['YGG_OSR_CXX', 'YGG_OSR_LINK',
'CL', '_CL_']:
v = env.get(k, None)
Expand All @@ -207,7 +209,7 @@ def compile_dependencies(cls, target='OpenSimRootYgg', toolname=None,
cwd = os.path.join(cwd, 'StaticBuild')
if target == 'cleanygg':
kwargs['dry_run'] = True
flag_options = DependencySpecialization.as_command_flags(kwargs)
flag_options += DependencySpecialization.as_command_flags(kwargs)
if flag_options:
env['YGG_OSR_FLAG_OPTIONS'] = flag_options.strip()
if target != 'cleanygg':
Expand Down
2 changes: 1 addition & 1 deletion yggdrasil/python-rapidjson
Submodule python-rapidjson updated 1 files
+2 −2 geometry.cpp
7 changes: 6 additions & 1 deletion yggdrasil/serialize/PlySerialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,12 @@ def concatenate(cls, objects, **kwargs):
if len(objects) == 0:
return []
total = type(objects[0])(objects[0])
out = total.merge(objects[1:], no_copy=True)
try:
out = total.merge(objects[1:], no_copy=True)
except TypeError: # pragma: debug
print(f"type(total) = {type(total)}\n"
f"type(objects) = {[type(x) for x in objects]}")
raise
return [out]

@classmethod
Expand Down

0 comments on commit bbb83c8

Please sign in to comment.