From a7f378047f1325094c09623583fb538eff1fdb3f Mon Sep 17 00:00:00 2001 From: Ofek Lev Date: Mon, 26 Jun 2023 09:44:27 -0400 Subject: [PATCH] Fix regression in the `PYAPP_EXEC_SPEC` option --- build.rs | 2 ++ docs/changelog.md | 4 ++++ src/app.rs | 6 +++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 641898a..04ba830 100644 --- a/build.rs +++ b/build.rs @@ -664,6 +664,7 @@ fn set_execution_mode() { // Set defaults set_runtime_variable(module_variable, ""); set_runtime_variable(code_variable, ""); + set_runtime_variable("PYAPP__EXEC_CODE_ENCODED", "0"); set_runtime_variable(script_variable, ""); set_runtime_variable("PYAPP__EXEC_SCRIPT_NAME", ""); set_runtime_variable("PYAPP__EXEC_SCRIPT_ID", ""); @@ -691,6 +692,7 @@ fn set_execution_mode() { ); } else if !code.is_empty() { set_runtime_variable(code_variable, STANDARD_NO_PAD.encode(code)); + set_runtime_variable("PYAPP__EXEC_CODE_ENCODED", "1"); } else if !script.is_empty() { let path = PathBuf::from(&script); if !path.is_file() { diff --git a/docs/changelog.md b/docs/changelog.md index df21da5..eab29da 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -8,6 +8,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), ## Unreleased +***Fixed:*** + +- Fix regression in the `PYAPP_EXEC_SPEC` option + ## 0.10.0 - 2023-06-26 ***Added:*** diff --git a/src/app.rs b/src/app.rs index 7ff7ccf..36d4974 100644 --- a/src/app.rs +++ b/src/app.rs @@ -129,7 +129,11 @@ pub fn exec_module() -> String { } pub fn exec_code() -> String { - decode_option(env!("PYAPP_EXEC_CODE")) + if env!("PYAPP__EXEC_CODE_ENCODED") == "1" { + decode_option(env!("PYAPP_EXEC_CODE")) + } else { + env!("PYAPP_EXEC_CODE").into() + } } pub fn exec_script() -> String {