Exemplo n.º 1
0
    def create_launcher(self, binfile):
        """ Create one launcher file. """
        create_dir(settings.BIN_DIR) # in case it's the first time

        launcher = join(settings.BIN_DIR, binfile)
        tmp = join(settings.TEMPLATE_DIR, settings.BINFILE_TEMPLATE)
        template = join(os.path.dirname(__file__), tmp)

        # fill substitutes
        substitutes = settings.LAUNCHER_SUBS
        app_dir = self.app_model.app_dir
        substitutes['activate'] = join(app_dir, settings.ACTIVATE_FILE)
        substitutes['binfile'] = binfile
        if not create_templated_file(launcher, template, substitutes):
            message = "Can't create launcher file: {0}".format(launcher)
            self.view.print_error_and_exit(message)

        os.chmod(launcher, 0755) # make it executable
Exemplo n.º 2
0
    def create_app_bootstrap(self):
        """ Create the bootstrap file. """
        app_dir = self.app_model.app_dir
        bootstrap = join(app_dir, settings.BOOTSTRAP_NAME)
        tmp = join(settings.TEMPLATE_DIR, settings.BOOTSTRAP_TEMPLATE)
        template = join(os.path.dirname(__file__), tmp)

        # fill substitutes
        substitutes = settings.BOOTSTRAP_SUBS
        substitutes['package'] = self.app_model.name
        if not create_templated_file(bootstrap, template, substitutes):
            message = "Can't create bootstrap file: {0}".format(bootstrap)
            self.view.print_error_and_exit(message)

        # sourcing
        if not bash_file(bootstrap):
            message = "Package install failed!"
            self.view.print_error_and_exit(message)