Skip to content
Snippets Groups Projects
Select Git revision
  • 06427258f04403fecfb463b54f4bb0fbceff12c4
  • dev default protected
  • main protected
  • chore/using-handlebars
4 results

main.py

Blame
  • main.py 809 B
    import os
    
    dumpAstVersionFileName = '../dumpAst/src/main/resources/dumpAstVersion.properties'
    
    
    def get_version():
        if os.environ.get('CI_COMMIT_BRANCH', 'unknown') == 'dev':
            return 'dev'
        with open(dumpAstVersionFileName) as dumpAstVersionFile:
            versionFileContent = dumpAstVersionFile.read()
        return versionFileContent[versionFileContent.rindex('version=') + 8:].strip()
    
    
    def define_env(env):
        """
        This is the hook for defining variables, macros and filters
    
        - variables: the dictionary that contains the environment variables
        - macro: a decorator function, to declare a macro.
        """
        env.conf['site_name'] = 'dumpAst ' + get_version()
    
        @env.macro
        def dumpAst_version():
            return get_version()
    
    
    if __name__ == '__main__':
        print(get_version())