File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -88,8 +88,6 @@ def process_cpp_library(
8888 return
8989 click .echo ("✓ Path check passed" )
9090
91- # TODO: Update main repo files for C++
92- # This will need implementation once we know the exact file structure
9391
9492 # Show diffs if verify flag is set
9593 if verify :
@@ -820,23 +818,7 @@ def main(
820818 config .package_install = True
821819 click .echo ("✓ Using CMake package installation for headers" )
822820
823- # Normalize versions by checking git tags
824- click .echo ("Checking git tags for version format..." )
825- missing_versions = config .normalize_versions_with_git_lookup ()
826-
827- if missing_versions :
828- click .echo ("❌ Error: The following versions were not found in the repository:" )
829- for version in missing_versions :
830- click .echo (f" - { version } " )
831- click .echo ("Please check the version numbers and try again." )
832- exit (1 )
833- else :
834- click .echo ("✓ All versions found in repository" )
835-
836- if config .target_prefix :
837- click .echo (
838- f"✓ Detected version format requires target_prefix: { config .target_prefix } "
839- )
821+ config .validate_versions_and_exit_on_missing ()
840822 else :
841823 # Interactive mode
842824 config = ask_library_questions ()
Original file line number Diff line number Diff line change @@ -221,21 +221,6 @@ def ask_library_questions() -> LibraryConfig:
221221 # Create the config and normalize versions with git lookup
222222 config = LibraryConfig (** config_data )
223223
224- # Normalize versions by checking git tags (only for non-Rust)
225- if language != Language .RUST :
226- print ("\n Checking git tags for version format..." )
227- missing_versions = config .normalize_versions_with_git_lookup ()
228-
229- if missing_versions :
230- print ("❌ Error: The following versions were not found in the repository:" )
231- for version in missing_versions :
232- print (f" - { version } " )
233- print ("Please check the version numbers and try again." )
234- exit (1 )
235- else :
236- print ("✓ All versions found in repository" )
237-
238- if config .target_prefix :
239- print (f"✓ Detected version format requires target_prefix: { config .target_prefix } " )
224+ config .validate_versions_and_exit_on_missing ()
240225
241226 return config
Original file line number Diff line number Diff line change @@ -318,6 +318,29 @@ def normalize_versions_with_git_lookup(self) -> list[str]:
318318
319319 return missing_versions
320320
321+ def validate_versions_and_exit_on_missing (self ) -> None :
322+ """
323+ Validate versions for non-Rust libraries and exit with error if any are missing.
324+ This function handles the common pattern of checking versions and failing fast.
325+ """
326+ if self .language == Language .RUST :
327+ return # Rust versions don't need git tag validation
328+
329+ print ("\n Checking git tags for version format..." )
330+ missing_versions = self .normalize_versions_with_git_lookup ()
331+
332+ if missing_versions :
333+ print ("❌ Error: The following versions were not found in the repository:" )
334+ for version in missing_versions :
335+ print (f" - { version } " )
336+ print ("Please check the version numbers and try again." )
337+ exit (1 )
338+ else :
339+ print ("✓ All versions found in repository" )
340+
341+ if self .target_prefix :
342+ print (f"✓ Detected version format requires target_prefix: { self .target_prefix } " )
343+
321344 def get_versions (self ) -> list [str ]:
322345 """Get list of versions, handling both single and multiple version cases"""
323346 if isinstance (self .version , str ):
You can’t perform that action at this time.
0 commit comments