How to use the jsii._embedded function in jsii

To help you get started, we’ve selected a few jsii examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / jsii / packages / @jsii / python-runtime / src / jsii / _kernel / providers / process.py View on Github external
jsii._embedded.jsii.__loader__, importlib.machinery.SourceFileLoader
        ):
            paths = [
                self._ctx_stack.enter_context(
                    importlib_resources.path(jsii._embedded.jsii, f)
                )
                for f in filenames
            ]
        else:
            tmpdir = self._ctx_stack.enter_context(tempfile.TemporaryDirectory())
            paths = [os.path.join(tmpdir, filename) for filename in filenames]

            for path, filename in zip(paths, filenames):
                with open(path, "wb") as fp:
                    fp.write(
                        importlib_resources.read_binary(jsii._embedded.jsii, filename)
                    )

        # Ensure that our jsii-runtime.js is the first entry in our paths, and that all
        # of our paths, are in a commmon directory, and we didn't get them split into
        # multiple directories somehow.
        assert os.path.basename(paths[0]) == filenames[0]
        assert os.path.commonpath(paths) == os.path.dirname(paths[0])

        # Return our first path, which should be the path for jsii-runtime.js
        return str(paths[0])