Пример #1
0
    def handle_install(self, src, dest):
        tltxtp = os.path.join(src, self.distinfo_name, "top_level.txt")
        files_installed = []

        try:
            distinfo_name = self.distinfo_name
            p = self.copytree(distinfo_name,
                              os.path.join(src, distinfo_name),
                              dest,
                              remove=True)
            files_installed.append(p)
        except Exception as e:
            __stdout__.write(str(e) + "\n")

        with open(tltxtp, "r") as fin:
            for pkg_name in fin:
                pure = pkg_name.replace("\r", "").replace("\n", "")
                sp = os.path.join(src, pure)
                if os.path.exists(sp):
                    p = self.copytree(pure, sp, dest, remove=True)
                elif os.path.exists(sp + ".py"):
                    dp = os.path.join(dest, pure + ".py")
                    p = self.copytree(pure, sp + ".py", dp, remove=True)
                else:
                    raise WheelError(
                        "top_level.txt entry '{e}' not found in toplevel directory!"
                        .format(e=pure))
                files_installed.append(p)
        return files_installed
Пример #2
0
    def handle_install(self, src, dest):
        tltxtp = os.path.join(src, self.distinfo_name, "top_level.txt")
        record = False
        if not os.path.isfile(tltxtp):
            record = True
            tltxtp = os.path.join(src, self.distinfo_name, "RECORD")
        files_installed = []

        try:
            distinfo_name = self.distinfo_name
            p = self.copytree(distinfo_name,
                              os.path.join(src, distinfo_name),
                              dest,
                              remove=True)
            if p is not None:
                files_installed.append(p)
        except Exception as e:
            __stdout__.write(str(e) + "\n")

        with open(tltxtp, "r") as fin:
            for pkg_name in fin:
                pure = pkg_name.replace("\r", "").replace("\n",
                                                          "").split(",")[0]
                sp = os.path.join(src, pure)
                if record:
                    p = os.path.join(dest, pure)

                    try:
                        os.makedirs(os.path.dirname(p))
                    except:
                        pass

                    copyfile(sp, p)
                elif os.path.exists(sp):
                    p = self.copytree(pure, sp, dest, remove=True)
                elif os.path.exists(sp + ".py"):
                    dp = os.path.join(dest, pure + ".py")
                    p = self.copytree(pure, sp + ".py", dp, remove=True)
                else:
                    raise WheelError(
                        "top_level.txt entry '{e}' not found in toplevel directory!"
                        .format(e=pure))
                files_installed.append(p)
        return files_installed
Пример #3
0
 def write():
     __stdout__.write(buffer.getvalue())