Best Python code snippet using localstack_python
release_jars.py
Source:release_jars.py
...12sourceforge_scp_base_url = "frs.sourceforge.net:/home/frs/project/verdict"13sourceforge_download_base_url = "https://sourceforge.net/projects/verdict/files"14push_to_git = False15supported_platforms = yaml.load(open(os.path.join(script_dir, 'supported_platforms.yml')))16def get_version_string(j_version):17 return "%s.%s.%s" % (j_version['major'], j_version['minor'], j_version['build'])18def get_cli_zip_filename(platform, j_version):19 # return 'verdict-cli-%s-%s.zip' % (platform, get_version_string(j_version))20 return 'verdict-cli-%s.zip' % (get_version_string(j_version))21def remove_cli_zip(j_version):22 print 'removes cli zip file.'23 for f in glob.glob('verdict*.zip'):24 call(['rm', f])25def zip_command_line_interface(j_version):26 zip_name = get_cli_zip_filename(None, j_version)27 print 'creating a zip archive: %s' % zip_name28 folder_name = 'verdict-cli-%s' % get_version_string(j_version)29 call(['rm', '-rf', folder_name])30 call(['mkdir', folder_name])31 files_to_copy = ['README.md',32 'LICENSE',33 'bin',34 'jars',35 'jdbc_jars',36 'conf']37 for f in files_to_copy:38 call(['cp', '-r', f, folder_name])39 call(['zip', '-r', zip_name, folder_name])40 # for family, versions in supported_platforms.iteritems():41 # for v, env in versions.iteritems():42 # if 'shell' not in env:43 # continue44 # zip_name = get_cli_zip_filename(v, j_version)45 46def update_verdict_site(j_version):47 """48 The download page in the verdict documentation should include49 1. the correct link to the repository50 2. the correct compiled jar files.51 """52 print 'updates verdict site.'53 sf_url = 'https://sourceforge.net/projects/verdict/files/%d.%d' % (j_version['major'], j_version['minor'])54 g = git.cmd.Git(verdict_site_dir)55 g.pull()56 verdict_site_conf_file = os.path.join(verdict_site_dir, '_config.yml')57 y = yaml.load(open(verdict_site_conf_file))58 y['url'] = "http://verdictdb.org/"59 y['version'] = get_version_string(j_version)60 # spark (core)61 yspark = {}62 # for family, versions in supported_platforms.iteritems():63 # for v, env in versions.iteritems():64 # if 'spark' not in env:65 # continue66 # yspark[v] = {}67 # yspark[v]['family'] = family68 # yspark[v]['name'] = 'verdict-spark-lib-%s-%s.jar' % (v, get_version_string(j_version))69 # yspark[v]['url'] = '%s/verdict-spark-lib-%s-%s.jar/download' % (sf_url, v, get_version_string(j_version))70 yspark['family'] = 'Verdict Spark Library'71 yspark['name'] = 'verdict-spark-lib-%s.jar' % get_version_string(j_version)72 yspark['url'] = '%s/verdict-spark-lib-%s.jar/download' % (sf_url, get_version_string(j_version))73 y['verdict_spark'] = yspark74 # jdbc75 yjdbc = {}76 # for family, versions in supported_platforms.iteritems():77 # for v, env in versions.iteritems():78 # if 'jdbc' not in env:79 # continue80 # yjdbc[v] = {}81 # yjdbc[v]['family'] = family82 # yjdbc[v]['name'] = 'verdict-jdbc-%s-%s.jar' % (v, get_version_string(j_version))83 # yjdbc[v]['url'] = '%s/verdict-jdbc-%s-%s.jar/download' % (sf_url, v, get_version_string(j_version))84 yjdbc['family'] = 'Verdict JDBC Driver'85 yjdbc['name'] = 'verdict-spark-lib-%s.jar' % get_version_string(j_version)86 yjdbc['url'] = '%s/verdict-jdbc-%s.jar/download' % (sf_url, get_version_string(j_version))87 y['verdict_jdbc'] = yjdbc88 # shell89 yshell = {}90 # for family, versions in supported_platforms.iteritems():91 # for v, env in versions.iteritems():92 # if 'shell' not in env:93 # continue94 # yshell[v] = {}95 # yshell[v]['family'] = family96 # yshell[v]['name'] = 'verdict-cli-%s-%s.zip' % (v, get_version_string(j_version))97 # yshell[v]['url'] = '%s/verdict-cli-%s-%s.zip/download' % (sf_url, v, get_version_string(j_version))98 yshell['family'] = 'Command Line Interface (including Verdict JDBC Driver)'99 yshell['name'] = 'verdict-cli-%s.jar' % get_version_string(j_version)100 yshell['url'] = '%s/verdict-cli-%s.zip/download' % (sf_url, get_version_string(j_version))101 y['verdict_shell'] = yshell102 with open(verdict_site_conf_file, 'w') as fout:103 fout.write("# auto generated by release/release_jars.py\n\n")104 fout.write(yaml.dump(y, default_flow_style=False))105 106 try:107 g.execute(['git', 'commit', '-am', 'version updated to %s' % get_version_string(j_version)])108 except git.exc.GitCommandError:109 pass110 if push_to_git:111 g.push()112def update_verdict_doc(j_version):113 """114 The download page in the verdict documentation should include115 1. the correct link to the repository116 2. the correct compiled jar files.117 """118 print 'updates verdict documentation.'119 g = git.cmd.Git(verdict_doc_dir)120 g.pull()121 verdict_doc_conf_file = os.path.join(verdict_doc_dir, 'conf.py')122 version_str = '%s.%s.%s' % (j_version['major'], j_version['minor'], j_version['build'])123 lines = [l for l in open(verdict_doc_conf_file)]124 updated_lines = []125 for l in lines:126 result1 = re.match("version = .*", l)127 result2 = re.match("release = .*", l)128 if result1 is None and result2 is None:129 updated_lines.append(l)130 elif result1:131 updated_lines.append("version = u'%s'\n" % (version_str))132 elif result2:133 updated_lines.append("release = u'%s'\n" % (version_str))134 with open(verdict_doc_conf_file, 'w') as conf_file_out:135 conf_file_out.write("".join(updated_lines))136 try:137 g.execute(['git', 'commit', '-am', 'version updated to %s' % version_str])138 except git.exc.GitCommandError:139 pass140 if push_to_git:141 g.push()142def get_path_to_files_to_upload(j_version):143 paths = []144 jars_dir = os.path.join(script_dir, '../jars')145 # get_version_string(j_version)146 paths.append(os.path.join(jars_dir, 'verdict-spark-lib-%s.jar' % get_version_string(j_version)))147 paths.append(os.path.join(jars_dir, 'verdict-jdbc-%s.jar' % get_version_string(j_version)))148 paths.append(get_cli_zip_filename(None, j_version))149 # for family, versions in supported_platforms.iteritems():150 # for v, env in versions.iteritems():151 # if 'spark' in env:152 # paths.append(os.path.join(jars_dir, 'verdict-spark-lib-%s-%s.jar' % (v, get_version_string(j_version))))153 # if 'jdbc' in env:154 # paths.append(os.path.join(jars_dir, 'verdict-jdbc-%s-%s.jar' % (v, get_version_string(j_version))))155 # if 'shell' in env:156 # paths.append(get_cli_zip_filename(v, j_version))157 return paths158def call_with_failure(cmd):159 ret = call(cmd)160 if ret != 0:161 raise ValueError('shell return code indicates a failure.')162def create_sourceforge_dir_if_not_exists(j_version):163 print 'creates a version-specific folder if not exists.'164 v = "%d.%d" % (j_version['major'], j_version['minor'])165 mkdir_str = "mkdir -p /home/frs/project/verdict/%s" % v166 call_with_failure(['ssh', "yongjoop,verdict@shell.sourceforge.net", 'create'])167 call_with_failure(['ssh', "yongjoop,verdict@shell.sourceforge.net", mkdir_str])168def upload_file_to_sourceforge(path, j_version):...
info.py
Source:info.py
1# -*- coding: utf-8 -*-2import ctypes3from opus.api import libopus4strerror = libopus.opus_strerror5strerror.argtypes = (ctypes.c_int,)6strerror.restype = ctypes.c_char_p7strerror.__doc__ = '''Converts an opus error code into a human readable string'''8get_version_string = libopus.opus_get_version_string9get_version_string.argtypes = None10get_version_string.restype = ctypes.c_char_p...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!