Ejemplo n.º 1
0
    def run(self):
        from umdinst.setup import gen_config, gen_wrappers

        env = self.distribution.get_command_obj("install")
        # First, check to make sure the javapath is valid
        if env.with_hackystat:
            if (env.javapath is not None) and (env.javapath is not "") and not os.access(env.javapath, os.X_OK):
                # raise ValueError, "Could not find java executable in 'javapath' specified in config: " + env.javapath + "\nSpecify a valid java executable with the '--javapath=' option or disable Hackystat with the '--without-hackystat' option."
                print "Error: could not find java executable in 'javapath' specified in config: " + env.javapath + "\nSpecify a valid java executable with the '--javapath=' option or disable Hackystat with the '--without-hackystat' option."
                sys.exit(-1)

        # Sanity check, make sure there's a keyfile, or setup will fail for now
        if not os.path.exists(os.path.join("conf", env.keyfile)):
            raise ValueError, "Cannot locate keyfile (%s) which is needed for installation." % env.keyfile

        # Sanity check, make sure there's a askfile, or setup will fail for now
        if not os.path.exists(os.path.join("conf", env.whitelistfile)):
            raise ValueError, "Cannot locate askfile (%s) which is needed for installation." % env.whitelistfile

        # Generate the config file for runtime
        platform_specific_file = os.path.join("scripts", "wrapper", "platform_specific.py")
        gen_config.gen_platform_specific_config(env, platform_specific_file)

        # Generate the wrapper scripts
        absprefix = os.path.abspath(env.prefix)
        version = "%d.%d" % sys.version_info[:2]
        libpath = """%s/lib/python%s/site-packages""" % (absprefix, version)
        gen_wrappers.gen_wrappers(env, libpath)

        if env.with_pooledlog:
            logfiledir = os.path.join(absprefix, ".data")
            self.createdir(logfiledir)
            from stat import S_IRWXU, S_IRWXG, S_IRWXO

            os.chmod(logfiledir, S_IRWXU | S_IRWXG | S_IRWXO)
            print """changing mode of %s to 777 for pooled logging""" % logfiledir

        # from umdinst.setup import autobackup
        # autobackup.launch_backup_daemon()

        # Finally, a dirty trick to add dynamically generated scripts
        # to the script list
        self.scripts = self.scripts + [
            "scripts/wrapper/" + x for x in os.listdir("scripts/wrapper/") if not os.path.isdir(x)
        ]

        # Run the default build_script.run() method
        build_scripts.run(self)
Ejemplo n.º 2
0
    def setUp(self):
        self.modulename = "testconfiglocal"
        self.fname = self.modulename + ".py"

        class Environment:
            prefix = ""
            id = ""
            whitelistfile = ""
            keyfile = ""
            encoding = ""
            javapath = ""
            with_pooledlog = False
            with_privatelog = False
            with_privatecvs = False
            with_workflow = False
            with_hackystat = False
            hackystat_host = ""

        env = Environment()
        self.cfg = gen_config.gen_platform_specific_config(env, self.fname)
        # FIXME: the current generator closes the config file, so
        # this test cannot be conducted
        # self.cfg.writevar('foo','bar')
        # self.cfg.writevar('mylist',[1,2,3,4])
        # self.cfg.close()
        self.module = __import__(self.modulename)