From a2f1d9cc96b21ebaf23b2d2ab68a17e6e588456d Mon Sep 17 00:00:00 2001 From: gong yong sheng Date: Tue, 7 Mar 2017 15:48:42 +0800 Subject: [PATCH] Remove the customized test-requirements script The gate-test-requirements job is doing the same thing. We cannot use revert since it is breaking the gate-test-requiremnts job. Change-Id: Ie5f4304b0cb59fda9bcc87df518e4c2ad9915b60 --- tools/README.rst | 19 ------- tools/sync_test_requirements.py | 90 --------------------------------- tox.ini | 1 - 3 files changed, 110 deletions(-) delete mode 100644 tools/README.rst delete mode 100755 tools/sync_test_requirements.py diff --git a/tools/README.rst b/tools/README.rst deleted file mode 100644 index 001be7da4..000000000 --- a/tools/README.rst +++ /dev/null @@ -1,19 +0,0 @@ -======================== -Tools for tacker -======================== - -sync_test_requirements.py -======================== - -Sync the test-requirements.txt with openstack global requirements. -Assume requirements prject is cloned at /opt/stack/requirements, to run:: - - $ git clone https://git.openstack.org/openstack/requirements.git /opt/stack/requirements - $ ./sync_test_requirements.py -g /opt/stack/requirements/global-requirements.txt -t ../test-requirements.txt -o ../test-requirements.txt - -If this tool shows us the "../test-requirements.txt" is changed, -please commit it. - -This tool is also used in tox.ini to check if the test-requirements.txt is -synchroized with global-requirements.txt. please refer to tox.ini for the -usage. diff --git a/tools/sync_test_requirements.py b/tools/sync_test_requirements.py deleted file mode 100755 index 1cd965f6c..000000000 --- a/tools/sync_test_requirements.py +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/python - -import getopt -import re -import sys -import tempfile - - -def printusage(): - print('sync_test_requirements.py -g ' - ' -t ' - ' [-o ]') - - -def main(argv): - globareqfile = '' - testreqfile = '' - outputfile = '' - check = False - try: - opts, args = getopt.getopt( - argv,"hg:t:o:", - ["globalrequirements=", "testrequirements=", "outputfile="]) - except getopt.GetoptError: - printusage() - sys.exit(2) - - for opt, arg in opts: - if opt == '-h': - printusage() - sys.exit() - elif opt in ("-g", "--globalrequirements"): - globareqfile = arg - elif opt in ("-o", "--outputfile"): - outputfile = arg - elif opt in ("-t", "--testrequirements"): - testreqfile = arg - if not outputfile: - with tempfile.NamedTemporaryFile(delete=False) as tempf: - outputfile = tempf.name - check = True - if not (globareqfile and testreqfile and (outputfile or check)): - printusage() - sys.exit(2) - - lines = [] - gmodules = {} - changed = 0 - with open(testreqfile) as testfile: - lines = testfile.readlines() - with open(globareqfile) as globalfile: - globallines = globalfile.readlines() - for gline in globallines: - gline = gline.rstrip('\n') - gmodulename = re.split('[<>=]', gline)[0] - moduleparts = gline.split("#") - modulepart = moduleparts[0].rstrip(" ") - modulelicense = ("" if len(moduleparts) <= 1 else - moduleparts[1].strip(" ")) - gmodules[gmodulename] =(modulepart, modulelicense) - with open(outputfile, 'w') as ofile: - for line in lines: - if line.startswith('#'): - ofile.write(line) - continue - line = line.rstrip('\n') - modulename = re.split('[<>=]', line)[0] - moduleparts = line.split("#") - modulepart = moduleparts[0].rstrip(" ") - modulelicense = ("" if len(moduleparts) <= 1 else - moduleparts[1].strip(" ")) - if (gmodules.get(modulename) and - (modulepart, modulelicense) != gmodules.get(modulename)): - changed = 1 - if gmodules.get(modulename)[1]: - ofile.write(" # ".join(gmodules.get(modulename)) + "\n") - else: - ofile.write(gmodules.get(modulename)[0] + "\n") - else: - ofile.write(line + "\n") - if changed: - if check: - print("%s is not synchronized with global requirements." % - testreqfile) - else: - print(testreqfile + " is changed.\n") - sys.exit(1) - -if __name__ == "__main__": - main(sys.argv[1:]) diff --git a/tox.ini b/tox.ini index ac47bff5f..0ab07676d 100644 --- a/tox.ini +++ b/tox.ini @@ -26,7 +26,6 @@ setenv = {[testenv]setenv} deps = {[testenv:functional]deps} commands = - {toxinidir}/tools/sync_test_requirements.py -g {toxinidir}/../requirements/global-requirements.txt -t {toxinidir}/test-requirements.txt ) {toxinidir}/tools/ostestr_compat_shim.sh --concurrency 2 {posargs} [tox:jenkins]