mirror of
https://github.com/aljazceru/dev-gpt.git
synced 2025-12-20 07:04:20 +01:00
🕵 fix: ignore hidden files
This commit is contained in:
2
setup.py
2
setup.py
@@ -7,7 +7,7 @@ def read_requirements():
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='gptdeploy',
|
name='gptdeploy',
|
||||||
version='0.18.25',
|
version='0.18.26',
|
||||||
description='Use natural language interface to generate, deploy and update your microservice infrastructure.',
|
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=open('README.md', 'r', encoding='utf-8').read(),
|
||||||
long_description_content_type='text/markdown',
|
long_description_content_type='text/markdown',
|
||||||
|
|||||||
@@ -1,2 +1,2 @@
|
|||||||
__version__ = '0.18.25'
|
__version__ = '0.18.26'
|
||||||
from src.cli import main
|
from src.cli import main
|
||||||
@@ -1,8 +1,19 @@
|
|||||||
import os
|
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):
|
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):
|
def version_max_fn(path_list):
|
||||||
version_list = [int(path.split('/')[-1].replace('v', '')) for path in 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')
|
raise ValueError(f'Path {microservice_path} does not exist')
|
||||||
if not os.path.isdir(microservice_path):
|
if not os.path.isdir(microservice_path):
|
||||||
raise ValueError(f'Path {microservice_path} is not a directory')
|
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.')
|
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.')
|
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)
|
latest_version_path = get_latest_version_path(microservice_path)
|
||||||
required_files = [
|
required_files = [
|
||||||
|
|||||||
Reference in New Issue
Block a user