§
!A?hŸF ã óp — d Z ddlZddlZddlZddlmZ ddlmZmZm Z m
Z
mZ ddlmZ G d„ d¦ « Z
dS )ztdistutils.cmd
Provides the Command class, the base class for the command classes
in the distutils.command package.
é N)ÚDistutilsOptionError)ÚutilÚdir_utilÚ file_utilÚarchive_utilÚdep_util©Úlogc óø — e Zd ZdZg Zd„ Zd„ Zd„ Zd„ Zd„ Z d%d „Z
d
„ Zd&d„Zd
„ Z
d'd„Zd'd„Zd„ Z d'd„Zd„ Zd„ Zd„ Zd„ Zd&d„Zd(d„Zd„ Zd„ Zd„ Zd)d„Zd*d„Z d+d„Z d,d „Zd&d!„Zd-d"„Z d.d#„Z! d/d$„Z"dS )0ÚCommanda} Abstract base class for defining command classes, the "worker bees"
of the Distutils. A useful analogy for command classes is to think of
them as subroutines with local variables called "options". The options
are "declared" in 'initialize_options()' and "defined" (given their
final values, aka "finalized") in 'finalize_options()', both of which
must be defined by every command class. The distinction between the
two is necessary because option values might come from the outside
world (command line, config file, ...), and any options dependent on
other options must be computed *after* these outside influences have
been processed -- hence 'finalize_options()'. The "body" of the
subroutine, where it does all its work based on the values of its
options, is the 'run()' method, which must also be implemented by every
command class.
c ó — ddl m} t ||¦ « st d¦ « ‚| j t
u rt
d¦ « ‚|| _ | ¦ « d| _ |j
| _
d| _ d| _ d| _
dS )zÞCreate and initialize a new Command object. Most importantly,
invokes the 'initialize_options()' method, which is the real
initializer and depends on the actual command being
instantiated.
r )ÚDistributionz$dist must be a Distribution instancezCommand is an abstract classN)Údistutils.distr Ú
isinstanceÚ TypeErrorÚ __class__r ÚRuntimeErrorÚdistributionÚinitialize_optionsÚ_dry_runÚverboseÚforceÚhelpÚ finalized)ÚselfÚdistr s ú:/opt/alt/python-internal/lib64/python3.11/distutils/cmd.pyÚ__init__zCommand.__init__/ s¡ € ð 0Ð/Ð/Ð/Ð/Ð/å˜$ Ñ-Ô-ð DÝÐBÑCÔCÐCØŒ>�WÐ$Ð$ÝÐ=Ñ>Ô>Ð>à ˆÔØ×ÒÑ!Ô!Ð!𠈌
ð ”|ˆŒð ˆŒ
𠈌 𠈌ˆˆó c ó„ — |dk r,t | d|z ¦ « }|€t | j |¦ « S |S t |¦ « ‚)NÚdry_runÚ_)Úgetattrr ÚAttributeError)r ÚattrÚmyvals r Ú__getattr__zCommand.__getattr___ sK € Ø�9ÒÐݘD #¨¡*Ñ-Ô-ˆE؈}ݘtÔ0°$Ñ7Ô7Ð7à�å Ñ&Ô&Ð&r c óJ — | j s| ¦ « d| _ d S ©Né )r Úfinalize_options©r s r Úensure_finalizedzCommand.ensure_finalizedi s) € ØŒ~ð $Ø×!Ò!Ñ#Ô#Ð#؈Œˆˆr c ó0 — t d| j z ¦ « ‚)aÙ Set default values for all the options that this command
supports. Note that these defaults may be overridden by other
commands, by the setup script, by config files, or by the
command-line. Thus, this is not the place to code dependencies
between options; generally, 'initialize_options()' implementations
are just a bunch of "self.foo = None" assignments.
This method must be implemented by all command classes.
ú,abstract method -- subclass %s must override©r r r, s r r zCommand.initialize_options{ ó# € õ ÐIØ!œ^ñ,ñ -ô -ð -r c ó0 — t d| j z ¦ « ‚)a Set final values for all the options that this command supports.
This is always called as late as possible, ie. after any option
assignments from the command-line or from other commands have been
done. Thus, this is the place to code option dependencies: if
'foo' depends on 'bar', then it is safe to set 'foo' from 'bar' as
long as 'foo' still has the same value it was assigned in
'initialize_options()'.
This method must be implemented by all command classes.
r/ r0 r, s r r+ zCommand.finalize_optionsˆ s# € õ ÐIØ!œ^ñ,ñ -ô -ð -r NÚ c óz — ddl m} |€d| ¦ « z }| ||z t j ¬¦ « |dz }| j D ]j\ }}}| |¦ « }|d dk r
|d d… }t | |¦ « }| ||›d|›�z t j ¬¦ « Œkd S ) Nr )Ú
longopt_xlatezcommand options for '%s':)Úlevelz éÿÿÿÿú=z = ) Údistutils.fancy_getoptr5 Úget_command_nameÚannouncer
ÚINFOÚuser_optionsÚ translater# )r ÚheaderÚindentr5 Úoptionr" Úvalues r Údump_optionszCommand.dump_options— së € Ø8Ð8Ð8Ð8Ð8Ð8؈>Ø0°4×3HÒ3HÑ3JÔ3JÑJˆFØ�
Š
�f˜v‘oS¬Xˆ
Ñ6Ô6Ð6ؘ$‘ˆØ"Ô/ð *ð *‰NˆV�Q˜Ø×%Ò% mÑ4Ô4ˆFØ�bŒz˜SÒ Ð Ø œ�ݘD &Ñ)Ô)ˆEØ�MŠM˜&°°°¸¸Ð#>Ñ>Ý #¤ð
ñ
*ô
*ð
*ð
*ð *ð *r c ó0 — t d| j z ¦ « ‚)a¾ A command's raison d'etre: carry out the action it exists to
perform, controlled by the options initialized in
'initialize_options()', customized by other commands, the setup
script, the command-line, and config files, and finalized in
'finalize_options()'. All terminal output and filesystem
interaction should be done by 'run()'.
This method must be implemented by all command classes.
r/ r0 r, s r ÚrunzCommand.run¥ r1 r r* c ó0 — t j ||¦ « dS )zmIf the current verbosity level is of greater than or equal to
'level' print 'msg' to stdout.
Nr )r Úmsgr6 s r r; zCommand.announce² s € õ Œ��sÑÔÐÐÐr c ót — ddl m} |r/t |¦ « t j ¦ « dS dS )z~Print 'msg' to stdout if the global DEBUG (taken from the
DISTUTILS_DEBUG environment variable) flag is true.
r )ÚDEBUGN)Údistutils.debugrI ÚprintÚsysÚstdoutÚflush)r rG rI s r Údebug_printzCommand.debug_print¸ sM € ð *Ð)Ð)Ð)Ð)Ð)Øð Ý�#‰JŒJˆJÝŒJ×ÒÑÔÐÐÐð ð r c ó¬ — t | |¦ « }|€t | ||¦ « |S t |t ¦ « st d|›d|›d|›d�¦ « ‚|S )Nú'z' must be a z (got `z`))r# Úsetattrr Ústrr )r rA ÚwhatÚdefaultÚvals r Ú_ensure_stringlikezCommand._ensure_stringlikeÏ sq € Ý�d˜FÑ#Ô#ˆØˆ;Ý�D˜& 'Ñ*Ô*Ð*؈NݘC¥Ñ%Ô%ð >Ý&Ð&Ø*0¨&¨&°$°$°$¸¸¸ð(=ñ >ô >ð
>àˆ
r c ó4 — | |d|¦ « dS )zWEnsure that 'option' is a string; if not defined, set it to
'default'.
ÚstringN)rW )r rA rU s r Ú
ensure_stringzCommand.ensure_stringÙ s" € ð
×Ò ¨°'Ñ:Ô:Ð:Ð:Ð:r c ó6 — t | |¦ « }|€dS t |t ¦ « r&t | |t j d|¦ « ¦ « dS t |t ¦ « rt d„ |D ¦ « ¦ « }nd}|st d|›d|›d�¦ « ‚dS )zîEnsure that 'option' is a list of strings. If 'option' is
currently a string, we split it either on /,\s*/ or /\s+/, so
"foo bar baz", "foo,bar,baz", and "foo, bar baz" all become
["foo", "bar", "baz"].
Nz,\s*|\s+c 3 ó@ K — | ]}t |t ¦ « V — Œd S ©N)r rS )Ú.0Úvs r ú