diff --git a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt index ff4b6be482..daa4a7b4dd 100644 --- a/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt +++ b/codegen-server/python/src/main/kotlin/software/amazon/smithy/rust/codegen/server/python/smithy/customizations/PythonServerCodegenDecorator.kt @@ -23,7 +23,6 @@ import software.amazon.smithy.rust.codegen.server.python.smithy.generators.Pytho import software.amazon.smithy.rust.codegen.server.smithy.ServerCodegenContext import software.amazon.smithy.rust.codegen.server.smithy.customizations.AddInternalServerErrorToAllOperationsDecorator import software.amazon.smithy.rust.codegen.server.smithy.customize.ServerCodegenDecorator -import java.io.File /** * Configure the [lib] section of `Cargo.toml`. @@ -206,14 +205,11 @@ class AddStubgenScriptDecorator : ServerCodegenDecorator { override val order: Byte = 0 override fun extras(codegenContext: ServerCodegenContext, rustCrate: RustCrate) { - val runtimeCratesPath = codegenContext.runtimeConfig.runtimeCratesPath() - val stubgenPythonLocation = "$runtimeCratesPath/aws-smithy-http-server-python/stubgen.py" - val stubgenPythonContent = File(stubgenPythonLocation).readText(Charsets.UTF_8) + val stubgenPythonContent = this::class.java.getResource("/stubgen.py").readText() rustCrate.withFile("stubgen.py") { writeWithNoFormatting("$stubgenPythonContent") } - val stubgenShellLocation = "$runtimeCratesPath/aws-smithy-http-server-python/stubgen.sh" - val stubgenShellContent = File(stubgenShellLocation).readText(Charsets.UTF_8) + val stubgenShellContent = this::class.java.getResource("/stubgen.sh").readText() rustCrate.withFile("stubgen.sh") { writeWithNoFormatting("$stubgenShellContent") } diff --git a/codegen-server/python/src/main/resources/stubgen.py b/codegen-server/python/src/main/resources/stubgen.py new file mode 120000 index 0000000000..6cc4240437 --- /dev/null +++ b/codegen-server/python/src/main/resources/stubgen.py @@ -0,0 +1 @@ +../../../../../rust-runtime/aws-smithy-http-server-python/stubgen.py \ No newline at end of file diff --git a/codegen-server/python/src/main/resources/stubgen.sh b/codegen-server/python/src/main/resources/stubgen.sh new file mode 120000 index 0000000000..5aee6f429d --- /dev/null +++ b/codegen-server/python/src/main/resources/stubgen.sh @@ -0,0 +1 @@ +../../../../../rust-runtime/aws-smithy-http-server-python/stubgen.sh \ No newline at end of file