@@ -0,0 +1,2050 @@
+#!/usr/bin/env python%0A%22%22%22jenkins_release - release ohWafHelpers to linn public (openhome) artifacts%0A%22%22%22%0Aimport os%0Aimport sys%0Aimport tarfile%0Atry:%0A    import boto3%0Aexcept:%0A    print('%5CnAWS fetch requires boto3 module')%0A    print(%22Please install this using 'pip install boto3'%5Cn%22)%0Aelse:%0A    # create AWS credentials file (if not already present)%0A    home = None%0A    if 'HOMEPATH' in os.environ and 'HOMEDRIVE' in os.environ:%0A        home = os.path.join(os.environ%5B'HOMEDRIVE'%5D, os.environ%5B'HOMEPATH'%5D)%0A    elif 'HOME' in os.environ:%0A        home = os.environ%5B'HOME'%5D%0A    if home:%0A        awsCreds = os.path.join(home, '.aws', 'credentials')%0A        if not os.path.exists(awsCreds):%0A            if sys.version_info%5B0%5D == 2:%0A                from urllib2 import urlopen%0A            else:%0A                from urllib.request import urlopen%0A            try:%0A                os.mkdir(os.path.join(home, '.aws'))%0A            except:%0A                pass%0A            credsFile = urlopen('http://core.linn.co.uk/~artifacts/artifacts/aws-credentials' )%0A            creds = credsFile.read()%0A            with open(awsCreds, 'wt') as f:%0A                f.write(creds)%0A%0Aexcludes = %5B'.git',%0A            '.gitignore',%0A            'jenkins_release.py'%5D%0A%0AjobName = 'ohWafHelpers'%0Aif 'JOB_NAME' in os.environ:%0A    jobName  = os.environ%5B'JOB_NAME'%5D%0A%0ApublishVersion = '0.0.0'%0Aif 'PUBLISH_VERSION' in os.environ:%0A    publishVersion  = os.environ%5B'PUBLISH_VERSION'%5D%0A%0Aitems = os.listdir('.')%0AtarName = '%25s-%25s.tar.gz' %25 (jobName, publishVersion)%0Aprint('Creating %25s' %25 tarName)%0Atar = tarfile.TarFile(name=tarName, mode='w')%0Afor item in items:%0A    if item not in excludes:%0A        print('    adding %25s' %25 item)%0A        tar.add(item, arcname='ohWafHelpers/%25s' %25 item)%0Atar.close()%0A%0AawsBucket = 'linn.artifacts.public'%0Aresource = boto3.resource('s3')%0Aprint('Publish %25s -%3E s3://%25s/artifacts/%25s/%25s' %25 (tarName, awsBucket, jobName, tarName))%0Abucket = resource.Bucket( awsBucket )%0Awith open(tarName, 'rb') as data:%0A    bucket.upload_fileobj(data, 'artifacts/%25s/%25s' %25 (jobName, tarName))%0A

Create jenkins_release script