def run(self):
        module_id = self._determine_module_id()
        self.announce(
            'Creating module_info file for module: {}'.format(module_id),
            level=log.INFO
        )

        # This command is never used interactively, so it doesn't make
        # sense to add support for passing in repo details like the
        # artifactory_upload command does. If that changes in the future
        # this command can always be enhanced at that time. The work
        # involved to add the options isn't so much in the code changes
        # to this command as in the test coverage that would need to be
        # written. It would also probably require refactoring the
        # commands to share a common base class. All this currently
        # falls under YAGNI (You're Not Going To Need It).

        verify_cert = not self.no_cert_verify
        repo_details = read_options()

        pip_package_path_finder = PipPackagePathFinder()

        def determine_checksums(file_path):
            return artifactory_rest.determine_checksums(
                username=repo_details.username,
                password=repo_details.password,
                repo_pull_id=repo_details.repo_pull_id,
                repo_base_url=repo_details.repo_base_url,
                file_path=file_path,
                verify_cert=verify_cert)

        checksum_dependency_helper = ChecksumDependencyHelper(
            determine_file_path_fn=pip_package_path_finder.determine_file_path,
            determine_checksums_from_file_path_fn=determine_checksums)

        build_info_module_generator = BuildInfoModuleGenerator(
            determine_dependency_checksums_fn=checksum_dependency_helper)

        requirements_file = compute_requirements_filename_full_path(
            artifact_id=module_id.artifact_id,
            version=module_id.version)

        module_info_file = compute_module_info_filename_full_path(
            artifact_id=module_id.artifact_id,
            version=module_id.version)

        build_info_module_generator.update(
            module_id=module_id,
            module_properties={},
            freeze_file=requirements_file,
            dist_files=self.distribution.dist_files,
            module_file=module_info_file,
            force_dependency_rebuild=bool(self.force_dependency_rebuild),
            force_clean=bool(self.force_clean))

        self.announce(
            'Module info file created at: {}'.format(module_info_file),
            level=log.INFO)
示例#2
0
    def run(self):
        module_id = self._determine_module_id()
        self.announce(
            'Creating module_info file for module: {}'.format(module_id),
            level=log.INFO)

        # This command is never used interactively, so it doesn't make
        # sense to add support for passing in repo details like the
        # artifactory_upload command does. If that changes in the future
        # this command can always be enhanced at that time. The work
        # involved to add the options isn't so much in the code changes
        # to this command as in the test coverage that would need to be
        # written. It would also probably require refactoring the
        # commands to share a common base class. All this currently
        # falls under YAGNI (You're Not Going To Need It).

        verify_cert = not self.no_cert_verify
        repo_details = read_options()

        pip_package_path_finder = PipPackagePathFinder()

        def determine_checksums(file_path):
            return artifactory_rest.determine_checksums(
                username=repo_details.username,
                password=repo_details.password,
                repo_pull_id=repo_details.repo_pull_id,
                repo_base_url=repo_details.repo_base_url,
                file_path=file_path,
                verify_cert=verify_cert)

        checksum_dependency_helper = ChecksumDependencyHelper(
            determine_file_path_fn=pip_package_path_finder.determine_file_path,
            determine_checksums_from_file_path_fn=determine_checksums)

        build_info_module_generator = BuildInfoModuleGenerator(
            determine_dependency_checksums_fn=checksum_dependency_helper)

        requirements_file = compute_requirements_filename_full_path(
            artifact_id=module_id.artifact_id, version=module_id.version)

        module_info_file = compute_module_info_filename_full_path(
            artifact_id=module_id.artifact_id, version=module_id.version)

        build_info_module_generator.update(
            module_id=module_id,
            module_properties={},
            freeze_file=requirements_file,
            dist_files=self.distribution.dist_files,
            module_file=module_info_file,
            force_dependency_rebuild=bool(self.force_dependency_rebuild),
            force_clean=bool(self.force_clean))

        self.announce(
            'Module info file created at: {}'.format(module_info_file),
            level=log.INFO)
示例#3
0
    def run(self):
        output_file = compute_requirements_filename_full_path(
            artifact_id=self.distribution.metadata.name,
            version=self.distribution.metadata.version)

        # 1. Perform a 'pip freeze' and write to output file. The
        #    captured packages are in site-packages.
        self.__pip_freeze(output_file)

        # 2. Append all eggs in the current directory to the output
        #    file. These packages do not appear in site-packages and are
        #    not caught by 'pip freeze' in the previous step. However,
        #    they are still part of the environment and should be listed.
        self.__freeze_eggs(output_file)

        # TODO: Capture packages in os.environ['PYTHONPATH']?

        # 3. Add output file to self.distribution.dist_files list.
        self.distribution.dist_files.append((
            'freeze',  # Distribution is the same as the command name
            None,  # No specific Python version
            output_file))   # Output filename