diff --git a/silecs_cli/silecs.py b/silecs_cli/silecs.py index 000f24d8d07792d23e10d44de1a653bc9a6f1606..cfc16eae16dbbf22043625312781239315517b7a 100644 --- a/silecs_cli/silecs.py +++ b/silecs_cli/silecs.py @@ -8,9 +8,9 @@ import subprocess import lxml.etree from xml.dom import minidom +import xmlschema from packaging import version -import xmlschema SILECS_VERSION = "2.3.0" SILECSDESIGN = "silecsdesign" @@ -502,6 +502,19 @@ def get_silecs_version_from_project(project_path): except Exception as e: print(e) +def get_available_versions(): + subfolders = [f.name for f in os.scandir(SILECS_BASE) if os.path.isdir(f)] + available_versions = [] + for f in subfolders: + try: + version.Version(f) + available_versions.append(f) + except version.InvalidVersion: + pass + + print(available_versions) + return available_versions + ##### Migrate file to new silecs version ###### def silecs_migrate(project_path, new_version): old_version = get_silecs_version_from_project(project_path) @@ -509,6 +522,7 @@ def silecs_migrate(project_path, new_version): old_version_underscored = get_version_underscored_tiny_as_x(old_version) new_version_underscored = get_version_underscored_tiny_as_x(new_version) + available_versions = get_available_versions() ##### Parse arguments ######