From edf6846069effba5b7c88bc96bd4cd852a4d7f2f Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Tue, 16 Apr 2013 20:52:38 -0400 Subject: Initial commit --- ipcbuild-setuptree.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ipcbuild-setuptree.py (limited to 'ipcbuild-setuptree.py') diff --git a/ipcbuild-setuptree.py b/ipcbuild-setuptree.py new file mode 100644 index 0000000..f3e997a --- /dev/null +++ b/ipcbuild-setuptree.py @@ -0,0 +1,37 @@ +import os +import sys + +try: + if sys.platform == 'linux' or sys.platform == 'darwin': + home = os.path.normpath(os.environ['HOME']) + elif sys.platform == 'win32': + home = os.path.normpath(os.environ['USERPROFILE']) +except: + Exception("Unsupported platform: {0:s}".format(sys.platform)) + +head = os.path.join(home, 'ipcbuild') +tree = ['BUILDROOT', + 'BUILD', + 'SPECS', + 'SOURCES', + 'PKGS', + 'SPKGS'] + +def create_dir(dirent): + print("Creating directory: {0:s}".format(dirent)) + os.mkdir(dirent) + +def main(): + try: + self.create_dir(head) + except: + print("{0:s} already exists, please remove it.".format(head)) + + try: + for d in tree: + self.create_dir(os.path.join(head, d)) + except: + pass + +if __name__ == '__main__': + main() \ No newline at end of file -- cgit