~ajkavanagh/+junk/useful-things

« back to all changes in this revision

Viewing changes to scripts/sync_charmhelpers.py

  • Committer: Alex Kavanagh
  • Date: 2018-06-13 14:08:47 UTC
  • mfrom: (11.1.1 useful-things)
  • Revision ID: alex.kavanagh@canonical.com-20180613140847-p71fivw0vk3ckre6
Just adding some stuff

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Sync the charmhelpers accross all the charms that we have
 
2
# Note that this only works if there is a charm-helpers-hooks.yaml in the
 
3
# directory
 
4
 
 
5
import os
 
6
import subprocess
 
7
import sys
 
8
 
 
9
CHARM_PREFIX = "./charms/"
 
10
 
 
11
 
 
12
def sync_charms():
 
13
    top_level_dirs = sorted(os.walk(CHARM_PREFIX).next()[1])
 
14
    for d in top_level_dirs:
 
15
        p = os.path.join(".", "charms", d)
 
16
        f = os.path.join(p, "charm-helpers-hooks.yaml")
 
17
        if os.path.isfile(os.path.join(f)):
 
18
            cmd = "make sync".format(p)
 
19
            print(cmd)
 
20
            subprocess.check_call(cmd.split(" "), cwd=p)
 
21
 
 
22
 
 
23
def main(argv):
 
24
    sync_charms()
 
25
 
 
26
 
 
27
if __name__ == '__main__':
 
28
    main(sys.argv)