~smoser/simplestreams/trunk.moved-to-git

« back to all changes in this revision

Viewing changes to tools/make-test-data

  • Committer: Scott Moser
  • Date: 2016-08-03 16:02:50 UTC
  • mfrom: (439.1.23 enable-tox)
  • Revision ID: smoser@ubuntu.com-20160803160250-9hjl6tgu0u0bgjjx
add running of tox.

This primarily moves a lot of things around to enable tox.
Some things here:
 * add ./tools/install-deps
   this allows easily installing dependencies to build or run tox
   (the openstack libraries require some c python extentions so
   you end up needing python-dev and such in order to run tox).

 * add tools/create-gpgdir and tools/sign-examples
   this just moves that logic out of Makefile to these places.

 * make tools/js2signed only re-create .sjson and .json.gpg
   files if the .json is newer. It supports '--force' to disable
   this logic.

 * move to using flake8 instead of pyflakes and pep8
   (flake8 uses pyflakes and pep8)

 * debian/control drop python-glanceclient and python3-keystoneclient
   these aren't available in trusty and thus can't build if they
   are there.  Also adjusted tests to skip these if not present.

 * split signjson_file out of toolutil as toolutil required
   distroinfo which is only needed by make testdata.

 * add a trusty-flake8 tox environment for testing versions
   of flake8, pep8, and pyflakes that are on trusty.  This allows
   us to catch what would be trusty specific build failures in tox.

Show diffs side-by-side

added added

removed removed

Lines of Context:
39
39
    url_error = urllib2
40
40
 
41
41
import toolutil
 
42
import sign_helper
 
43
 
42
44
 
43
45
# could support reading from other mirrors
44
46
# for example:
241
243
    if os.path.exists(url):
242
244
        return os.stat(url).st_size
243
245
 
244
 
    # http://stackoverflow.com/questions/4421170/python-head-request-with-urllib2
 
246
    # http://stackoverflow.com/questions/4421170/
 
247
    #  python-head-request-with-urllib2
245
248
    request = url_request(url)
246
249
    request.get_method = lambda: 'HEAD'
247
250
    response = url_open(request)
312
315
                {'combined_{}_sha256'.format(name): chash.hexdigest()})
313
316
 
314
317
    # Add legacy combined_sha256 if combined_rootxz_sha256 exists
315
 
    if (ftype == "lxd.tar.xz" and 'combined_sha256' not in FAKE_DATA[ftype]
316
 
            and 'combined_rootxz_sha256' in FAKE_DATA[ftype]):
 
318
    if (ftype == "lxd.tar.xz" and
 
319
            'combined_sha256' not in FAKE_DATA[ftype] and
 
320
            'combined_rootxz_sha256' in FAKE_DATA[ftype]):
317
321
        data.update({'combined_sha256':
318
322
                     FAKE_DATA[ftype]['combined_rootxz_sha256']})
319
323
 
693
697
            sys.stderr.write("signing %s\n" % name)
694
698
        for root, dirs, files in os.walk(args.out_d):
695
699
            for f in [f for f in files if f.endswith(".json")]:
696
 
                toolutil.signjson_file(os.path.join(root, f),
697
 
                                       status_cb=printstatus)
 
700
                sign_helper.signjson_file(os.path.join(root, f),
 
701
                                          status_cb=printstatus)
698
702
 
699
703
    return
700
704