Exemplo n.º 1
0
    def __init__(self, buck_bin_dir, buck_project):
        super(BuckRepo, self).__init__(buck_project)

        self.buck_dir = platform_path(os.path.dirname(buck_bin_dir))

        dot_git = os.path.join(self.buck_dir, '.git')
        self.is_git = os.path.exists(dot_git) and os.path.isdir(dot_git) and which('git') and \
            sys.platform != 'cygwin'
        self._is_buck_repo_dirty_override = os.environ.get(
            'BUCK_REPOSITORY_DIRTY')
        if not self._fake_buck_version:
            # self._fake_buck_version has been set previously through BuckTool when the environment
            # variable BUCK_FAKE_VERSION is set.
            # If the environement variable is not set, we'll use the content of .fakebuckversion
            # at the root of the repository if it exists.
            fake_buck_version_file_path = os.path.join(self.buck_dir,
                                                       ".fakebuckversion")
            if os.path.exists(fake_buck_version_file_path):
                with open(
                        fake_buck_version_file_path) as fake_buck_version_file:
                    self._fake_buck_version = fake_buck_version_file.read(
                    ).strip()
                    logging.info(
                        "Using fake buck version (via .fakebuckversion): {}".
                        format(self._fake_buck_version))
Exemplo n.º 2
0
    def __init__(self, buck_bin_dir, buck_project, buck_reporter):
        self.buck_dir = platform_path(os.path.dirname(buck_bin_dir))

        super(BuckRepo, self).__init__(buck_project, buck_reporter)

        dot_git = os.path.join(self.buck_dir, ".git")
        self.is_git = (
            os.path.exists(dot_git)
            and os.path.isdir(dot_git)
            and which("git")
            and sys.platform != "cygwin"
        )
        self._is_buck_repo_dirty_override = os.environ.get("BUCK_REPOSITORY_DIRTY")
        if not self._fake_buck_version:
            # self._fake_buck_version has been set previously through BuckTool when the environment
            # variable BUCK_FAKE_VERSION is set.
            # If the environement variable is not set, we'll use the content of .fakebuckversion
            # at the root of the repository if it exists.
            fake_buck_version_file_path = os.path.join(
                self.buck_dir, ".fakebuckversion"
            )
            if os.path.exists(fake_buck_version_file_path):
                with open(fake_buck_version_file_path) as fake_buck_version_file:
                    self._fake_buck_version = fake_buck_version_file.read().strip()
                    logging.info(
                        "Using fake buck version (via .fakebuckversion): {}".format(
                            self._fake_buck_version
                        )
                    )
Exemplo n.º 3
0
    def __init__(self, buck_bin_dir, buck_project):
        super(BuckRepo, self).__init__(buck_project)

        self.buck_dir = platform_path(os.path.dirname(buck_bin_dir))

        dot_git = os.path.join(self.buck_dir, '.git')
        self.is_git = os.path.exists(dot_git) and os.path.isdir(dot_git) and which('git') and \
            sys.platform != 'cygwin'
        self._is_buck_repo_dirty_override = os.environ.get('BUCK_REPOSITORY_DIRTY')
Exemplo n.º 4
0
    def __init__(self, buck_bin_dir, buck_project):
        super(BuckRepo, self).__init__(buck_project)

        self._buck_dir = platform_path(os.path.dirname(buck_bin_dir))
        self._build_success_file = os.path.join(self._buck_dir, "build",
                                                "successful-build")

        dot_git = os.path.join(self._buck_dir, '.git')
        self._is_git = os.path.exists(dot_git) and os.path.isdir(dot_git) and which('git') and \
            sys.platform != 'cygwin'
        self._is_buck_repo_dirty_override = os.environ.get(
            'BUCK_REPOSITORY_DIRTY')

        buck_version = buck_project.buck_version
        if self._is_git and not buck_project.has_no_buck_check and buck_version:
            revision = buck_version[0]
            branch = buck_version[1] if len(buck_version) > 1 else None
            self._checkout_and_clean(revision, branch)

        self._build()