zmc
2023-10-12 ed135d79df12a2466b52dae1a82326941211dcc9
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
U
G=®d!Tã@stdZddlZddlZddlZddlmZddlmZddlm    Z    ddl
Tddl m Z ddl mZGd    d
„d
eƒZdS) zwdistutils.command.bdist_rpm
 
Implements the Distutils 'bdist_rpm' command (create RPM source and binary
distributions).éN)ÚCommand)ÚDEBUG)Ú
write_file)Ú*)Úget_python_version)Úlogc)@s¸eZdZdZdddddddd    d
d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*g)Zd+d,d-d.d/gZd+d,d-d0œZd1d2„Zd3d4„Zd5d6„Z    d7d8„Z
d9d:„Z d;d<„Z d=d>„Z d?S)@Ú    bdist_rpmzcreate an RPM distribution)z bdist-base=Nz/base directory for creating built distributions)z    rpm-base=Nzdbase directory for creating RPMs (defaults to "rpm" under --bdist-base; must be specified for RPM 2))z    dist-dir=ÚdzDdirectory to put final RPM files in (and .spec files if --spec-only))zpython=NzMpath to Python interpreter to hard-code in the .spec file (default: "python"))z
fix-pythonNzLhard-code the exact path to the current Python interpreter in the .spec file)z    spec-onlyNzonly regenerate spec file)z source-onlyNzonly generate source RPM)z binary-onlyNzonly generate binary RPM)z    use-bzip2Nz7use bzip2 instead of gzip to create source distribution)zdistribution-name=Nzgname of the (Linux) distribution to which this RPM applies (*not* the name of the module distribution!))zgroup=Nz9package classification [default: "Development/Libraries"])zrelease=NzRPM release number)zserial=NzRPM serial number)zvendor=NzaRPM "vendor" (eg. "Joe Blow <joe@example.com>") [default: maintainer or author from setup script])z    packager=NzBRPM packager (eg. "Jane Doe <jane@example.net>") [default: vendor])z
doc-files=Nz6list of documentation files (space or comma-separated))z
changelog=Nz RPM changelog)zicon=Nzname of icon file)z    provides=Nz%capabilities provided by this package)z    requires=Nz%capabilities required by this package)z
conflicts=Nz-capabilities which conflict with this package)zbuild-requires=Nz+capabilities required to build this package)z
obsoletes=Nz*capabilities made obsolete by this package)ú
no-autoreqNz+do not automatically calculate dependencies)ú    keep-tempÚkz"don't clean up RPM build directory)ú no-keep-tempNz&clean up RPM build directory [default])úuse-rpm-opt-flagsNz8compile with RPM_OPT_FLAGS when building from source RPM)úno-rpm-opt-flagsNz&do not pass any RPM CFLAGS to compiler)ú    rpm3-modeNz"RPM 3 compatibility mode (default))ú    rpm2-modeNzRPM 2 compatibility mode)z prep-script=Nz3Specify a script for the PREP phase of RPM building)z build-script=Nz4Specify a script for the BUILD phase of RPM building)z pre-install=Nz:Specify a script for the pre-INSTALL phase of RPM building)zinstall-script=Nz6Specify a script for the INSTALL phase of RPM building)z post-install=Nz;Specify a script for the post-INSTALL phase of RPM building)zpre-uninstall=Nz<Specify a script for the pre-UNINSTALL phase of RPM building)zpost-uninstall=Nz=Specify a script for the post-UNINSTALL phase of RPM building)z clean-script=Nz4Specify a script for the CLEAN phase of RPM building)zverify-script=Nz6Specify a script for the VERIFY phase of the RPM build)z force-arch=Nz0Force an architecture onto the RPM build process)ÚquietÚqz3Run the INSTALL phase of RPM building in quiet moder rrr
r)r rrcCsîd|_d|_d|_d|_d|_d|_d|_d|_d|_d|_    d|_
d|_ d|_ d|_ d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_d|_ d|_!d|_"d|_#d|_$d|_%d|_&dS)Nré)'Ú
bdist_baseÚrpm_baseÚdist_dirÚpythonÚ
fix_pythonÚ    spec_onlyÚ binary_onlyÚ source_onlyÚ    use_bzip2Údistribution_nameÚgroupÚreleaseÚserialÚvendorÚpackagerÚ    doc_filesÚ    changelogÚiconÚ prep_scriptÚ build_scriptÚinstall_scriptÚ clean_scriptÚ verify_scriptÚ pre_installÚ post_installÚ pre_uninstallÚpost_uninstallÚprepÚprovidesÚrequiresÚ    conflictsÚbuild_requiresÚ    obsoletesÚ    keep_tempÚuse_rpm_opt_flagsÚ    rpm3_modeÚ
no_autoreqÚ
force_archr©Úself©r=ú^D:\z\workplace\VsCode\pyvenv\venv\Lib\site-packages\setuptools/_distutils/command/bdist_rpm.pyÚinitialize_options‡sNzbdist_rpm.initialize_optionscCsº| dd¡|jdkr6|js$tdƒ‚tj |jd¡|_|jdkrX|j    rPt
j |_qfd|_n|j    rftdƒ‚tj dkr~t dtj ƒ‚|jr’|jr’td    ƒ‚|j ¡s¢d
|_| dd ¡| ¡dS) NÚbdist)rrz)you must specify --rpm-base in RPM 2 modeÚrpmZpython3z8--python and --fix-python are mutually exclusive optionsÚposixz9don't know how to create RPM distributions on platform %sz6cannot supply both '--source-only' and '--binary-only'r)rr)Úset_undefined_optionsrr8ÚDistutilsOptionErrorÚosÚpathÚjoinrrrÚsysÚ
executableÚnameÚDistutilsPlatformErrorrrÚ distributionÚhas_ext_modulesr7Úfinalize_package_datar;r=r=r>Úfinalize_options´s6 
ÿ
 
ÿ
ÿ ÿ
 zbdist_rpm.finalize_optionscCsT| dd¡| dd|j ¡|j ¡f¡| d¡| d¡t|jtƒrxdD]&}tj     
|¡rP||jkrP|j  |¡qP| dd    ¡| d
¡| d ¡| d ¡|  |j ¡|_ | d ¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡| d¡dS)NrzDevelopment/Librariesr"z%s <%s>r#r$)ZREADMEz
README.txtr Ú1r!rr%r&r'r(r)r*r+r,r-r.r/r1r2r3r4r5r:)Ú ensure_stringrLÚ get_contactÚget_contact_emailÚensure_string_listÚ
isinstancer$ÚlistrErFÚexistsÚappendÚ_format_changelogr%Úensure_filename)r<Zreadmer=r=r>rNÓsB 
ÿÿ
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
zbdist_rpm.finalize_package_datacCs¾tr<tdƒtd|jƒtd|jƒtd|jƒtd|jƒ|jrT|j}| |¡n8i}dD]&}t    j
  |j |¡||<| ||¡q\|d}t    j
  |d|j  ¡¡}| t|| ¡fd    |¡|jrÈdS|j jdd…}| d
¡}|jròd g|_nd g|_| d
¡||j _| ¡d }|d}| ||¡|jrbt    j
 |j¡rT| |j|¡ntd|jƒ‚t d¡dg}    |jr†|     d¡n|j rš|     d¡n
|     d¡|     !dd|j"g¡|j#rÜ|     !ddt    j
 $|j ¡g¡|j%sî|     d¡|j&r|     d¡|     |¡d}
|
d} d|
d} d| | |f} t     '| ¡}z~g}d}| )¡}|sVq˜| *¡ +¡}t,|ƒdkstt-‚| |d ¡|dkrD|d }qD| (¡}|r¶t.d!t/| ƒƒ‚W5| (¡X| 0|    ¡|j1sº|j  2¡rêt3ƒ}nd"}|j sLt    j
  |d#|¡}t    j
 |¡st-‚| 4||j¡t    j
  |j|¡}|j j d$||f¡|jsº|D]`}t    j
  |d%|¡}t    j
 |¡rX| 4||j¡t    j
  |jt    j
 5|¡¡}|j j d$||f¡qXdS)&Nzbefore _get_package_data():zvendor =z
packager =z doc_files =z changelog =)ÚSOURCESÚSPECSÚBUILDÚRPMSÚSRPMSr\z%s.specz writing '%s'ÚsdistÚbztarÚgztarrr[zicon file '%s' does not existz building RPMsZrpmbuildz-bsz-bbz-baz--definez __python %sz
_topdir %sz--cleanz--quietz%{name}-%{version}-%{release}z.src.rpmz%{arch}/z .%{arch}.rpmz%rpm -q --qf '%s %s\n' --specfile '%s'érzFailed to execute: %sÚanyr_rr^)6rÚprintr"r#r$r%rrÚmkpathrErFrGrrLÚget_nameÚexecuterÚ_make_spec_fileÚ
dist_filesÚreinitialize_commandrÚformatsÚ run_commandZget_archive_filesÚ    copy_filer&rWÚDistutilsFileErrorrÚinforrXrÚextendrr8Úabspathr6rÚpopenÚcloseÚreadlineÚstripÚsplitÚlenÚAssertionErrorÚDistutilsExecErrorÚreprÚspawnÚdry_runrMrÚ    move_fileÚbasename)r<Zspec_dirZrpm_dirr    Z    spec_pathZsaved_dist_filesr`ÚsourceÚ
source_dirZrpm_cmdZ
nvr_stringZsrc_rpmZ non_src_rpmZq_cmdÚoutZ binary_rpmsZ
source_rpmÚlineÚlÚstatusZ    pyversionZsrpmÚfilenamerAr=r=r>ÚrunsÔ      ÿÿý
 
 
  ÿ
 
ÿ
 
 
 ÿ
 
 
 
 ÿ
 
ÿÿz bdist_rpm.runcCstj |jtj |¡¡S)N)rErFrGrr)r<rFr=r=r>Ú
_dist_path„szbdist_rpm._dist_pathc
CsJd|j ¡d|j ¡ dd¡d|j ¡d|j dd¡dd|j ¡g}t d    ¡}d
 d d „|     ¡Dƒ¡}d }d}| ||¡}||kr¨| 
d¡| 
d|d
¡|  dddg¡|j rÊ| 
d¡n
| 
d¡|  d|j  ¡d|jddg¡|js|j ¡s&| 
d¡n| 
d|j¡dD]V}t|| ¡ƒ}t|tƒrb| 
d|d |¡f¡n|dk    r*| 
d||f¡q*|j ¡d kr¦| 
d!|j ¡¡|jr¾| 
d"|j¡|jrÜ| 
d#d |j¡¡|jrü| 
d$tj |j¡¡|jr| 
d%¡|  dd&|j ¡g¡d'|jtj tj d(¡f}d)|}    |j!rXd*|    }    d+|}
d,d-d.|    fd/d0|
fd1d2d3d4d5d6g    } | D]n\} } }t|| ƒ}|s¦|r†|  dd7| g¡|rèt"|ƒ}|  | #¡ $d
¡¡W5QRXn
| 
|¡q†|  dd8d9g¡|j%r$| 
d:d |j%¡¡|j&rF|  dd;g¡|  |j&¡|S)<ziGenerate the text of an RPM spec file and return it as a
        list of strings (one per line).
        z %define name z%define version ú-Ú_z%define unmangled_version z%define release Úz    Summary: zrpm --eval %{__os_install_post}Ú
cSsg|]}d| ¡‘qS)z  %s \)rv)Ú.0rƒr=r=r>Ú
<listcomp>›sÿz-bdist_rpm._make_spec_file.<locals>.<listcomp>zbrp-python-bytecompile \
z%brp-python-bytecompile %{__python} \
z2# Workaround for http://bugs.python.org/issue14443z%define __os_install_post z Name: %{name}zVersion: %{version}zRelease: %{release}z-Source0: %{name}-%{unmangled_version}.tar.bz2z,Source0: %{name}-%{unmangled_version}.tar.gzz    License: zGroup: z>BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildrootzPrefix: %{_prefix}zBuildArch: noarchz BuildArch: %s)ZVendorZPackagerÚProvidesÚRequiresZ    ConflictsÚ    Obsoletesz%s: %sú NÚUNKNOWNzUrl: zDistribution: zBuildRequires: zIcon: z
AutoReq: 0z %descriptionz%s %srz%s buildzenv CFLAGS="$RPM_OPT_FLAGS" z>%s install -O1 --root=$RPM_BUILD_ROOT --record=INSTALLED_FILES)r0r'z&%setup -n %{name}-%{unmangled_version}Úbuildr(Úinstallr))Úcleanr*zrm -rf $RPM_BUILD_ROOT)Z verifyscriptr+N)Úprer,N)Úpostr-N)Zpreunr.N)Zpostunr/Nú%z%files -f INSTALLED_FILESz%defattr(-,root,root)z%doc z
%changelog)'rLrgÚ get_versionÚreplacer Úget_descriptionÚ
subprocessÚ    getoutputrGÚ
splitlinesrXrqrÚ get_licenserr:rMÚgetattrÚlowerrUrVÚget_urlrr4r&rErFrr9Úget_long_descriptionrrHÚargvr7ÚopenÚreadrwr$r%)r<Z    spec_fileZ vendor_hookÚproblemZfixedZ
fixed_hookÚfieldÚvalZdef_setup_callZ    def_buildZ install_cmdZscript_optionsZrpm_optÚattrÚdefaultÚfr=r=r>ri‡sÈ   ú
 
ÿ 
    ý 
 ü   
 
ÿ
ýÿ÷ 
 þ
 ýþ zbdist_rpm._make_spec_filecCs||s|Sg}| ¡ d¡D]N}| ¡}|ddkrB| d|g¡q|ddkrZ| |¡q| d|¡q|dsx|d=|S)zKFormat the changelog correctly and convert it to a list of strings
        rŒrrr‹r‰z  )rvrwrqrX)r<r%Z new_changelogrƒr=r=r>rY0s   zbdist_rpm._format_changelogN)Ú__name__Ú
__module__Ú __qualname__Ú descriptionÚ user_optionsÚboolean_optionsÚ negative_optr?rOrNr‡rˆrirYr=r=r=r>rsx—mÿþ--*r)Ú__doc__rrHrEÚdistutils.corerÚdistutils.debugrÚdistutils.file_utilrÚdistutils.errorsÚdistutils.sysconfigrÚ    distutilsrrr=r=r=r>Ú<module>s