From 4d8f7cb0556b5fe79606f3bb6f2cbb45c828588e Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 18 Jun 2025 08:33:22 -0600 Subject: [PATCH 1/5] Fixed windows no deployables found bug --- polyapi/deployables.py | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/polyapi/deployables.py b/polyapi/deployables.py index ac4f743..85f5671 100644 --- a/polyapi/deployables.py +++ b/polyapi/deployables.py @@ -112,20 +112,23 @@ class PolyDeployConfig(TypedDict): def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]: # Constructing the Windows command using dir and findstr - include_pattern = " ".join(f"*.{f}" if "." in f else f"*.{f}" for f in config["include_files_or_extensions"]) or "*" - exclude_pattern = '|'.join(config["exclude_dirs"]) - pattern = '|'.join(f"polyConfig: {name}" for name in config["type_names"]) or 'polyConfig' + include_pattern = " ".join(f"*.{f}" for f in config["include_files_or_extensions"]) or "*" + exclude_pattern = ' '.join(f"\\{f}" for f in config["exclude_dirs"]) + pattern = ' '.join(f"\\" for name in config["type_names"]) or 'polyConfig' - exclude_command = f" | findstr /V /I \"{exclude_pattern}\"" if exclude_pattern else '' - search_command = f" | findstr /M /I /F:/ /C:\"{pattern}\"" + exclude_command = f" | findstr /V /I \"{exclude_pattern}" if exclude_pattern else '' + search_command = f" | findstr /M /I /F:/ {pattern}" result = [] for dir_path in config["include_dirs"]: - dir_command = f"dir /S /P /B {include_pattern} {dir_path}" + if dir_path is not '.': + include_pattern = " ".join(f"{dir_path}*.{f}" for f in config["include_files_or_extensions"]) or "*" + dir_command = f"dir {include_pattern} /S /P /B" full_command = f"{dir_command}{exclude_command}{search_command}" try: + print(full_command) output = subprocess.check_output(full_command, shell=True, text=True) - result.extend(output.strip().split('\r\n')) + result.extend(output.strip().split('\n')) except subprocess.CalledProcessError: pass return result @@ -154,7 +157,7 @@ def get_all_deployable_files(config: PolyDeployConfig) -> List[str]: if not config.get("include_files_or_extensions"): config["include_files_or_extensions"] = ["py"] if not config.get("exclude_dirs"): - config["exclude_dirs"] = ["poly", "node_modules", "dist", "build", "output", ".vscode", ".poly", ".github", ".husky", ".yarn"] + config["exclude_dirs"] = ["Lib", "node_modules", "dist", "build", "output", ".vscode", ".poly", ".github", ".husky", ".yarn"] is_windows = os.name == "nt" if is_windows: From 15834a693585d51b4635ab3823c323c48f590f49 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 18 Jun 2025 08:46:19 -0600 Subject: [PATCH 2/5] removed superfluous print --- polyapi/deployables.py | 1 - 1 file changed, 1 deletion(-) diff --git a/polyapi/deployables.py b/polyapi/deployables.py index 85f5671..2d070fa 100644 --- a/polyapi/deployables.py +++ b/polyapi/deployables.py @@ -126,7 +126,6 @@ def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]: dir_command = f"dir {include_pattern} /S /P /B" full_command = f"{dir_command}{exclude_command}{search_command}" try: - print(full_command) output = subprocess.check_output(full_command, shell=True, text=True) result.extend(output.strip().split('\n')) except subprocess.CalledProcessError: From 59efe36eefab5472178238fa1088a54064c788c2 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 18 Jun 2025 08:49:52 -0600 Subject: [PATCH 3/5] Fixed deployables not being staged properly --- polyapi/deployables.py | 2 ++ polyapi/prepare.py | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/polyapi/deployables.py b/polyapi/deployables.py index 2d070fa..08ff18e 100644 --- a/polyapi/deployables.py +++ b/polyapi/deployables.py @@ -116,6 +116,8 @@ def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]: exclude_pattern = ' '.join(f"\\{f}" for f in config["exclude_dirs"]) pattern = ' '.join(f"\\" for name in config["type_names"]) or 'polyConfig' + # Using two regular quotes or two smart quotes throws "The syntax of the command is incorrect". + # For some reason, starting with a regular quote and leaving the end without a quote works. exclude_command = f" | findstr /V /I \"{exclude_pattern}" if exclude_pattern else '' search_command = f" | findstr /M /I /F:/ {pattern}" diff --git a/polyapi/prepare.py b/polyapi/prepare.py index af953ec..c8babc5 100644 --- a/polyapi/prepare.py +++ b/polyapi/prepare.py @@ -1,5 +1,6 @@ import os import sys +import subprocess from typing import List, Tuple, Literal import requests @@ -135,6 +136,18 @@ def prepare_deployables(lazy: bool = False, disable_docs: bool = False, disable_ # NOTE: write_updated_deployable has side effects that update deployable.fileRevision which is in both this list and parsed_deployables for deployable in dirty_deployables: write_updated_deployable(deployable, disable_docs) + # Re-stage any updated staged files. + staged = subprocess.check_output('git diff --name-only --cached', shell=True, text=True, ).split('\n') + rootPath = subprocess.check_output('git rev-parse --show-toplevel', shell=True, text=True).replace('\n', '') + for deployable in dirty_deployables: + try: + deployableName = deployable["file"].replace('\\', '/').replace(f"{rootPath}/", '') + if deployableName in staged: + print(f'Staging {deployableName}') + subprocess.run(['git', 'add', deployableName]) + except: + print('Warning: File staging failed, check that all files are staged properly.') + print("Poly deployments are prepared.") save_deployable_records(parsed_deployables) From 0fb2f592545ab0c48fc014788ade86991a3d4547 Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 18 Jun 2025 09:06:40 -0600 Subject: [PATCH 4/5] Added .venv to excluded directories --- polyapi/deployables.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polyapi/deployables.py b/polyapi/deployables.py index 08ff18e..d5c8bea 100644 --- a/polyapi/deployables.py +++ b/polyapi/deployables.py @@ -158,7 +158,7 @@ def get_all_deployable_files(config: PolyDeployConfig) -> List[str]: if not config.get("include_files_or_extensions"): config["include_files_or_extensions"] = ["py"] if not config.get("exclude_dirs"): - config["exclude_dirs"] = ["Lib", "node_modules", "dist", "build", "output", ".vscode", ".poly", ".github", ".husky", ".yarn"] + config["exclude_dirs"] = ["Lib", "node_modules", "dist", "build", "output", ".vscode", ".poly", ".github", ".husky", ".yarn", ".venv"] is_windows = os.name == "nt" if is_windows: From 439c60047d24a04c54ee4e8fe1a3cc380c301e1f Mon Sep 17 00:00:00 2001 From: Daniel Estoll Date: Wed, 18 Jun 2025 09:15:28 -0600 Subject: [PATCH 5/5] Bumped version up to 0.3.8.dev1 --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 78f2d57..ce2b703 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev0" +version = "0.3.8.dev1" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [