当前位置: 首页>>代码示例>>Python>>正文


Python bdist_rpm._make_spec_file方法代码示例

本文整理汇总了Python中distutils.command.bdist_rpm.bdist_rpm._make_spec_file方法的典型用法代码示例。如果您正苦于以下问题:Python bdist_rpm._make_spec_file方法的具体用法?Python bdist_rpm._make_spec_file怎么用?Python bdist_rpm._make_spec_file使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在distutils.command.bdist_rpm.bdist_rpm的用法示例。


在下文中一共展示了bdist_rpm._make_spec_file方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _make_spec_file

# 需要导入模块: from distutils.command.bdist_rpm import bdist_rpm [as 别名]
# 或者: from distutils.command.bdist_rpm.bdist_rpm import _make_spec_file [as 别名]
def _make_spec_file(self):
        argv0 = sys.argv[0]
        features = []
        for ext in self.distribution.ext_modules:
            if not isinstance(ext, Extension):
                continue
            with_ext = getattr(self.distribution, ext.attr_name)
            if with_ext is None:
                continue
            if with_ext:
                features.append("--" + ext.option_name)
            else:
                features.append("--" + ext.neg_option_name)
        sys.argv[0] = " ".join([argv0] + features)
        spec_file = _bdist_rpm._make_spec_file(self)
        sys.argv[0] = argv0
        return spec_file 
开发者ID:python-poetry,项目名称:poetry,代码行数:19,代码来源:setup.py

示例2: _make_spec_file

# 需要导入模块: from distutils.command.bdist_rpm import bdist_rpm [as 别名]
# 或者: from distutils.command.bdist_rpm.bdist_rpm import _make_spec_file [as 别名]
def _make_spec_file(self):
        version = self.distribution.get_version()
        rpmversion = version.replace('-','_')
        spec = _bdist_rpm._make_spec_file(self)
        line23 = '%define version '+version
        line24 = '%define version '+rpmversion
        spec  = [
            line.replace(
                "Source0: %{name}-%{version}.tar",
                "Source0: %{name}-%{unmangled_version}.tar"
            ).replace(
                "setup.py install ",
                "setup.py install --single-version-externally-managed "
            ).replace(
                "%setup",
                "%setup -n %{name}-%{unmangled_version}"
            ).replace(line23,line24)
            for line in spec
        ]
        spec.insert(spec.index(line24)+1, "%define unmangled_version "+version)
        return spec 
开发者ID:GeekTrainer,项目名称:Flask,代码行数:23,代码来源:bdist_rpm.py

示例3: _make_spec_file

# 需要导入模块: from distutils.command.bdist_rpm import bdist_rpm [as 别名]
# 或者: from distutils.command.bdist_rpm.bdist_rpm import _make_spec_file [as 别名]
def _make_spec_file(self):
        specFile = _bdist_rpm._make_spec_file(self)
        line = next(i for i, s in enumerate(specFile) if s.startswith("%install"))
        specFile[line+1] += " --prefix=/usr --install-data=/usr/share --install-lib /usr/share/trelby"
        return specFile 
开发者ID:trelby,项目名称:trelby,代码行数:7,代码来源:setup.py

示例4: _make_spec_file

# 需要导入模块: from distutils.command.bdist_rpm import bdist_rpm [as 别名]
# 或者: from distutils.command.bdist_rpm.bdist_rpm import _make_spec_file [as 别名]
def _make_spec_file(self):
        spec_file = old_bdist_rpm._make_spec_file(self)

        # Replace hardcoded setup.py script name
        # with the real setup script name.
        setup_py = os.path.basename(sys.argv[0])
        if setup_py == 'setup.py':
            return spec_file
        new_spec_file = []
        for line in spec_file:
            line = line.replace('setup.py', setup_py)
            new_spec_file.append(line)
        return new_spec_file 
开发者ID:Frank-qlu,项目名称:recruit,代码行数:15,代码来源:bdist_rpm.py

示例5: _make_spec_file

# 需要导入模块: from distutils.command.bdist_rpm import bdist_rpm [as 别名]
# 或者: from distutils.command.bdist_rpm.bdist_rpm import _make_spec_file [as 别名]
def _make_spec_file(self):
        """Generates the text of an RPM spec file.

        Returns:
          A list of strings containing the lines of text.
        """
        # Note that bdist_rpm can be an old style class.
        if issubclass(BdistRPMCommand, object):
            spec_file = super(BdistRPMCommand, self)._make_spec_file()
        else:
            spec_file = bdist_rpm._make_spec_file(self)

        if sys.version_info[0] < 3:
            python_package = "python"
        else:
            python_package = "python3"

        description = []
        summary = ""
        in_description = False

        python_spec_file = []
        for line in spec_file:
            if line.startswith("Summary: "):
                summary = line

            elif line.startswith("BuildRequires: "):
                line = "BuildRequires: {0:s}-setuptools".format(python_package)

            elif line.startswith("Requires: "):
                if python_package == "python3":
                    line = line.replace("python", "python3")

            elif line.startswith("%description"):
                in_description = True

            elif line.startswith("%files"):
                line = "%files -f INSTALLED_FILES -n {0:s}-%{{name}}".format(
                    python_package)

            elif line.startswith("%prep"):
                in_description = False

                python_spec_file.append(
                    "%package -n {0:s}-%{{name}}".format(python_package))
                python_spec_file.append("{0:s}".format(summary))
                python_spec_file.append("")
                python_spec_file.append(
                    "%description -n {0:s}-%{{name}}".format(python_package))
                python_spec_file.extend(description)

            elif in_description:
                # Ignore leading white lines in the description.
                if not description and not line:
                    continue

                description.append(line)

            python_spec_file.append(line)

        return python_spec_file 
开发者ID:google,项目名称:dotty,代码行数:63,代码来源:setup.py


注:本文中的distutils.command.bdist_rpm.bdist_rpm._make_spec_file方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。