# SOME DESCRIPTIVE TITLE. # Copyright (C) 2001-2025, Python Software Foundation # This file is distributed under the same license as the Python package. # FIRST AUTHOR , YEAR. # # Translators: # python-doc bot, 2025 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: Python 3.9\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2025-01-03 16:35+0000\n" "PO-Revision-Date: 2025-09-22 17:54+0000\n" "Last-Translator: python-doc bot, 2025\n" "Language-Team: Chinese (China) (https://app.transifex.com/python-doc/teams/5390/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #: ../../distutils/configfile.rst:5 msgid "Writing the Setup Configuration File" msgstr "编写设置脚本的配置文件" #: ../../distutils/_setuptools_disclaimer.rst:3 msgid "" "This document is being retained solely until the ``setuptools`` " "documentation at https://setuptools.readthedocs.io/en/latest/setuptools.html" " independently covers all of the relevant information currently included " "here." msgstr "" "这篇文档是历史遗留文档,在 https://setuptools.readthedocs.io/en/latest/setuptools.html 上的" " ``setuptools`` 文档独立涵盖此处包含的所有相关信息之后,将不再单独作为正式文档保留。" #: ../../distutils/configfile.rst:9 msgid "" "Often, it's not possible to write down everything needed to build a " "distribution *a priori*: you may need to get some information from the user," " or from the user's system, in order to proceed. As long as that " "information is fairly simple---a list of directories to search for C header " "files or libraries, for example---then providing a configuration file, " ":file:`setup.cfg`, for users to edit is a cheap and easy way to solicit it." " Configuration files also let you provide default values for any command " "option, which the installer can then override either on the command-line or " "by editing the config file." msgstr "" "通常,在 *事前* 就写出构建发布包所需的一切是不可能的:你可能需要从用户或者用户的系统获取一些信息,才能继续下去。 只要这些信息相当简单 —— " "例如一个用于搜索 C 头文件或库的目录列表 —— 那么提供配置文件 :file:`setup.cfg` 供用户配置就是一个低成本且方便的解决方式。 " "配置文件还允许你为任何命令选项提供默认值,而安装器可以通过命令行或编辑配置文件来覆盖这些默认值。" #: ../../distutils/configfile.rst:18 msgid "" "The setup configuration file is a useful middle-ground between the setup " "script---which, ideally, would be opaque to installers [#]_---and the " "command-line to the setup script, which is outside of your control and " "entirely up to the installer. In fact, :file:`setup.cfg` (and any other " "Distutils configuration files present on the target system) are processed " "after the contents of the setup script, but before the command-line. This " "has several useful consequences:" msgstr "" "安装配置文件是在安装脚本和安装脚本命令行之间一个适当的折衷方式 --- 安装脚本在理想情况下应当不受安装者的控制 [#]_ --- " "而安装脚本命令行则在你的控制范围之外且完全取决于安装者的选择。 实际上,:file:`setup.cfg` (以及目标系统上的其他任何 " "Distutils 配置文件) 是在配置脚本之后、命令行之前被处理。 这导致了几个有用的后果:" #: ../../distutils/configfile.rst:32 msgid "" "installers can override some of what you put in :file:`setup.py` by editing " ":file:`setup.cfg`" msgstr "安装者可以通过编辑 :file:`setup.cfg` 来覆盖你放在 :file:`setup.py` 中的配置" #: ../../distutils/configfile.rst:35 msgid "" "you can provide non-standard defaults for options that are not easily set in" " :file:`setup.py`" msgstr "你可以为无法在 :file:`setup.py` 中方便设置的选项提供非标准的默认值" #: ../../distutils/configfile.rst:38 msgid "" "installers can override anything in :file:`setup.cfg` using the command-line" " options to :file:`setup.py`" msgstr "安装者可以使用 :file:`setup.py` 的命令行选项来覆盖 :file:`setup.cfg` 中的一切" #: ../../distutils/configfile.rst:41 msgid "The basic syntax of the configuration file is simple:" msgstr "配置文件的基本语法很简单:" #: ../../distutils/configfile.rst:49 msgid "" "where *command* is one of the Distutils commands (e.g. :command:`build_py`, " ":command:`install`), and *option* is one of the options that command " "supports. Any number of options can be supplied for each command, and any " "number of command sections can be included in the file. Blank lines are " "ignored, as are comments, which run from a ``'#'`` character until the end " "of the line. Long option values can be split across multiple lines simply " "by indenting the continuation lines." msgstr "" "其中 *command* 是一个 Distutils 命令 (例如 :command:`build_py`, :command:`install`),而" " *option* 是该命令所支持的某个选项。 可以为每个命令提供任意数量的选项,并且可以在文件中包括任意数量的命令组。 空白行会被忽略,以一个 " "``'#'`` 开始的注释行也是如此。 长选项值可以简单地通过缩进后续行的方式被拆分为多行。" #: ../../distutils/configfile.rst:57 msgid "" "You can find out the list of options supported by a particular command with " "the universal :option:`!--help` option, e.g." msgstr "你可以用通用的 :option:`!--help` 选项找出特定命令所支持的选项列表,例如" #: ../../distutils/configfile.rst:75 msgid "" "Note that an option spelled :option:`!--foo-bar` on the command-line is " "spelled ``foo_bar`` in configuration files." msgstr "请注意在命令行中拼写为 :option:`!--foo-bar` 的选项在配置文件中会拼写为 ``foo_bar``。" #: ../../distutils/configfile.rst:80 msgid "" "For example, say you want your extensions to be built \"in-place\"---that " "is, you have an extension :mod:`pkg.ext`, and you want the compiled " "extension file (:file:`ext.so` on Unix, say) to be put in the same source " "directory as your pure Python modules :mod:`pkg.mod1` and :mod:`pkg.mod2`. " "You can always use the :option:`!--inplace` option on the command-line to " "ensure this:" msgstr "" "例如,假设你希望你的扩展在“原地”构建 --- 就是说你有一个扩展 :mod:`pkg.ext`,你希望编译出的扩展文件 (例如在 Unix 上为 " ":file:`ext.so`) 放在与你的纯 Python 模块 :mod:`pkg.mod1` 和 :mod:`pkg.mod2` 相同的源目录中。 " "你总是可以在命令行中使用 :option:`!--inplace` 选项来确保这一点:" #: ../../distutils/configfile.rst:90 msgid "" "But this requires that you always specify the :command:`build_ext` command " "explicitly, and remember to provide :option:`!--inplace`. An easier way is " "to \"set and forget\" this option, by encoding it in :file:`setup.cfg`, the " "configuration file for this distribution:" msgstr "" "但是这要求你总是显式地指定 :command:`build_ext` 命令,并且记得提供 :option:`!--inplace`。 " "一个更容易的方式是通过将其编码在此发布包的配置文件 :file:`setup.cfg` 中,“设置并忘记”该选项。" #: ../../distutils/configfile.rst:100 msgid "" "This will affect all builds of this module distribution, whether or not you " "explicitly specify :command:`build_ext`. If you include :file:`setup.cfg` " "in your source distribution, it will also affect end-user builds---which is " "probably a bad idea for this option, since always building extensions in-" "place would break installation of the module distribution. In certain " "peculiar cases, though, modules are built right in their installation " "directory, so this is conceivably a useful ability. (Distributing " "extensions that expect to be built in their installation directory is almost" " always a bad idea, though.)" msgstr "" "这将影响此模块发布包的所有构建,不论你是否显式指定 :command:`build_ext`。 如果你在你的源发布包中包括了 " ":file:`setup.cfg`,它还将影响最终用户的构建 --- 对此选项来说这可能不是个好主意,因为总是原地构建扩展会破坏模块发布包的安装。 " "不过在某些特殊情况下,模块是在其安装目录中被构建的,因此这可能会是个有用的功能。 (但是,发布预期在其安装目录中被构建的扩展几乎总是一个坏主意。)" #: ../../distutils/configfile.rst:109 msgid "" "Another example: certain commands take a lot of options that don't change " "from run to run; for example, :command:`bdist_rpm` needs to know everything " "required to generate a \"spec\" file for creating an RPM distribution. Some" " of this information comes from the setup script, and some is automatically " "generated by the Distutils (such as the list of files installed). But some " "of it has to be supplied as options to :command:`bdist_rpm`, which would be " "very tedious to do on the command-line for every run. Hence, here is a " "snippet from the Distutils' own :file:`setup.cfg`:" msgstr "" "另一个例子:特定的命令会接受许多在多次运行中都不发生变化的选项;例如,:command:`bdist_rpm` 需要知道为创建 RPM 发布包生成 " "\"spec\" 文件所要求的所有信息。 这些信息有的来自安装脚本,有的由 Distutils 自动生成(例如已安装文件列表)。 但有的则必须作为 " ":command:`bdist_rpm` 的选项提供,每次运行时都在命令行中完成将会非常繁琐。 因此,这里提供 Distutils 本身的 " ":file:`setup.cfg` 中的一段代码:" #: ../../distutils/configfile.rst:129 msgid "" "Note that the ``doc_files`` option is simply a whitespace-separated string " "split across multiple lines for readability." msgstr "请注意 ``doc_files`` 选项只是一个空格分隔以提高可读性的多行字符串。" #: ../../distutils/configfile.rst:136 msgid ":ref:`inst-config-syntax` in \"Installing Python Modules\"" msgstr "\"安装 Python 模块\" 中的 :ref:`inst-config-syntax`" #: ../../distutils/configfile.rst:136 msgid "" "More information on the configuration files is available in the manual for " "system administrators." msgstr "有关配置文件的更多信息可在系统管理员手册中查看。" #: ../../distutils/configfile.rst:141 msgid "Footnotes" msgstr "备注" #: ../../distutils/configfile.rst:142 msgid "" "This ideal probably won't be achieved until auto-configuration is fully " "supported by the Distutils." msgstr "在 Distutils 完全支持自动配置之前,这一理想可能是无法实现的。"