Browse Source

Allow generation of empty Python paks

pull/128/head
Adam Johnson 6 years ago
parent
commit
e4e1e97eb4
Signed by: Hoikas
GPG Key ID: 0B6515D6FF6F271E
  1. 3
      korman/exporter/python.py
  2. 4
      korman/korlib/python.py
  3. 3
      korman/operators/op_export.py

3
korman/exporter/python.py

@ -149,9 +149,12 @@ class PythonPackageExporter:
# DONE
report.progress_end()
report.raise_errors()
def _package_python(self, report):
py_code = self._compyle(report)
if not py_code:
report.error("No Python files were packaged.")
self._write_python_pak(py_code, report)
def _write_python_pak(self, py_code, report):

4
korman/korlib/python.py

@ -132,7 +132,9 @@ def package_python(stream, pyc_objects):
# ~~~~~
# uint32_t filesz
# uint8_t data[filesz]
assert bool(pyc_objects)
if not pyc_objects:
stream.writeInt(0)
return
# `stream` might be a plEncryptedStream, which doesn't seek very well at all.
# Therefore, we will go ahead and calculate the size of the index block so

3
korman/operators/op_export.py

@ -277,6 +277,9 @@ class PlasmaPythonExportOperator(ExportOperator, bpy.types.Operator):
except korlib.PythonNotAvailableError as error:
self.report({"ERROR"}, "Python Version {} not found".format(error))
return {"CANCELLED"}
except exporter.NonfatalExportError as error:
self.report({"WARNING"}, str(error))
return {"FINISHED"}
else:
return {"FINISHED"}

Loading…
Cancel
Save