diff --git a/polyapi/deployables.py b/polyapi/deployables.py index d5c8bea..f41d90a 100644 --- a/polyapi/deployables.py +++ b/polyapi/deployables.py @@ -114,18 +114,16 @@ def get_all_deployable_files_windows(config: PolyDeployConfig) -> List[str]: # Constructing the Windows command using dir and findstr 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' + pattern = ' '.join(f"/C:\"polyConfig: {name}\"" for name in config["type_names"]) or '/C:"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}" + exclude_command = f" | findstr /V /I \"{exclude_pattern}\"" if exclude_pattern else '' + search_command = f" | findstr /S /M /I /F:/ {pattern} *.*" result = [] for dir_path in config["include_dirs"]: - if dir_path is not '.': + if dir_path != '.': 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" + dir_command = f"dir {include_pattern} /S /P /B > NUL" full_command = f"{dir_command}{exclude_command}{search_command}" try: output = subprocess.check_output(full_command, shell=True, text=True) diff --git a/polyapi/prepare.py b/polyapi/prepare.py index c8babc5..565d139 100644 --- a/polyapi/prepare.py +++ b/polyapi/prepare.py @@ -32,7 +32,7 @@ def get_server_function_description(description: str, arguments, code: str) -> s api_key, api_url = get_api_key_and_url() headers = get_auth_headers(api_key) data = {"description": description, "arguments": arguments, "code": code} - response = requests.post(f"{api_url}/server-function-description", headers=headers, json=data) + response = requests.post(f"{api_url}/functions/server/description-generation", headers=headers, json=data) return response.json() def get_client_function_description(description: str, arguments, code: str) -> str: @@ -40,7 +40,7 @@ def get_client_function_description(description: str, arguments, code: str) -> s headers = get_auth_headers(api_key) # Simulated API call to generate client function descriptions data = {"description": description, "arguments": arguments, "code": code} - response = requests.post(f"{api_url}/client-function-description", headers=headers, json=data) + response = requests.post(f"{api_url}/functions/client/description-generation", headers=headers, json=data) return response.json() def fill_in_missing_function_details(deployable: DeployableRecord, code: str) -> DeployableRecord: @@ -138,13 +138,11 @@ def prepare_deployables(lazy: bool = False, disable_docs: bool = False, disable_ 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]) + if deployable["file"] in staged: + print(f'Staging {deployable["file"]}') + subprocess.run(['git', 'add', deployable["file"]]) except: print('Warning: File staging failed, check that all files are staged properly.') diff --git a/pyproject.toml b/pyproject.toml index e27bb41..99ffea9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,7 +3,7 @@ requires = ["setuptools>=61.2", "wheel"] [project] name = "polyapi-python" -version = "0.3.8.dev5" +version = "0.3.8.dev6" description = "The Python Client for PolyAPI, the IPaaS by Developers for Developers" authors = [{ name = "Dan Fellin", email = "dan@polyapi.io" }] dependencies = [