🕵 fix: ignore hidden files

This commit is contained in:
Florian Hönicke
2023-04-22 16:08:06 +02:00
parent c44a0b499f
commit d2ed75ca84
3 changed files with 16 additions and 5 deletions

View File

@@ -7,7 +7,7 @@ def read_requirements():
setup(
name='gptdeploy',
version='0.18.25',
version='0.18.26',
description='Use natural language interface to generate, deploy and update your microservice infrastructure.',
long_description=open('README.md', 'r', encoding='utf-8').read(),
long_description_content_type='text/markdown',

View File

@@ -1,2 +1,2 @@
__version__ = '0.18.25'
__version__ = '0.18.26'
from src.cli import main

View File

@@ -1,8 +1,19 @@
import os
def listdir_no_hidden(path):
"""
List all non-hidden files and directories in the specified path.
:param path: str, optional (default is '.')
The path to the directory you want to list files and directories from.
:return: list
A list of filenames and directory names that are not hidden.
"""
return [entry for entry in os.listdir(path) if not entry.startswith('.')]
def get_latest_folder(path, max_fn=max):
return max_fn([os.path.join(path, f) for f in os.listdir(path) if os.path.isdir(os.path.join(path, f))])
return max_fn([os.path.join(path, f) for f in listdir_no_hidden(path) if os.path.isdir(os.path.join(path, f))])
def version_max_fn(path_list):
version_list = [int(path.split('/')[-1].replace('v', '')) for path in path_list]
@@ -25,9 +36,9 @@ def validate_folder_is_correct(microservice_path):
raise ValueError(f'Path {microservice_path} does not exist')
if not os.path.isdir(microservice_path):
raise ValueError(f'Path {microservice_path} is not a directory')
if len(os.listdir(microservice_path)) == 0:
if len(listdir_no_hidden(microservice_path)) == 0:
raise ValueError(f'Path {microservice_path} is empty. Please generate a microservice first. Type `gptdeploy generate` for further instructions.')
if len(os.listdir(microservice_path)) > 1:
if len(listdir_no_hidden(microservice_path)) > 1:
raise ValueError(f'Path {microservice_path} needs to contain only one folder. Please make sure that you only have one microservice in this folder.')
latest_version_path = get_latest_version_path(microservice_path)
required_files = [