U •VÏYã@sÔdZddlmZddlmZddlmZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZddlmZddlmZdd lmZdd lmZdd lmZdd lmZdd lmZddlZddlmZddlmZdZdZdd„Zdd„Zdd„Zdd„Z dOdd„Z!dPdd„Z"Gdd „d ejƒZ#Gd!d"„d"ejƒZ$Gd#d$„d$ej%ƒZ&Gd%d&„d&e j'ƒZ(d'd(„Z)z&dd)l*m+Z+Gd*d+„d+e+j,ƒZ-d,Z.Wne/k r°dZ.YnXd-d.„Z0d/Z1d0Z2e2e2e1d1œZ3e j4 5e j6¡dfd2d3„Z7Gd4d5„d5ejƒZ8Gd6d7„d7ejƒZ9Gd8d9„d9ej:ƒZ;Gd:d;„d;ejƒZd?„d?ejƒZ>z dd@lm?Z?d,Z@e?jAZAe?jBZBWn"e/k rŠdZ@dZAdZBYnXdAdB„ZCdCdD„ZDdEdF„ZEdGdH„ZFdQdIdJ„ZGdKdL„ZHdRdMdN„ZIejJjKZKdS)Sz4 Utilities with minimum-depends for use in setup.py é)Úunicode_literals)Úinstall)ÚlogN)Údevelop)Ú easy_install)Úegg_info)Úinstall_scripts)Úsdist)Ú extra_files)Úgit)Úoptions)Ú testr_command)Úversion)zrequirements.txtztools/pip-requires)ztest-requirements.txtztools/test-requirescCsXtj d¡}|r(tdd„| d¡DƒƒSttdttj dƒj ttj j t ƒƒƒtt ƒS)NZPBR_REQUIREMENTS_FILEScss|]}| ¡VqdS©N©Ústrip©Ú.0Úf©rú>/opt/alt/python38/lib/python3.8/site-packages/pbr/packaging.pyÚ 5sz)get_requirements_files..ú,z-pyr)ÚosÚenvironÚgetÚtupleÚsplitÚlistÚmapÚstrÚsysÚ version_infoÚjoinÚpathÚsplitextÚREQUIREMENTS_FILES)ÚfilesrrrÚget_requirements_files2s  ÿþr(cCs:g}| |d¡}|r| |¡| |¡d |¡||<dS)z5Append a separated list to possibly existing value.ÚÚ N)rÚappendÚextendr#)ZconfigÚkeyZ text_listZ new_valueZ current_valuerrrÚappend_text_list?s    r.cCsdd„|DƒS)NcSsg|]}tj |¡r|‘qSr)rr$ÚexistsrrrrÚ Js z!_any_existing..r)Z file_listrrrÚ _any_existingIsr1c CsBt|ƒD]4}t|dƒ }| ¡ d¡W5QR£SQRXqgS)NÚrr*)r1ÚopenÚreadr)Úrequirements_filesZrequirements_fileZfilrrrÚget_reqs_from_filesNs  &r6Fc CsF|dkrtƒ}dd„}g}t|ƒD]}| ¡r"| d¡r=\2é)ÚreÚsubÚgroup)ÚmatchrrrÚ egg_fragmentZsþz(parse_requirements..egg_fragmentú#z-rú é)Ú strip_markersz\s*-e\s+z\s*-e\s+.*#egg=(.*)$ú \s*https?:z\s*https?:.*#egg=(.*)$z\s*-f\s+zIndex Locationz#.*$r)ú;rz[pbr] Excluding %s: %s)r(r6rÚ startswithÚ partitionÚparse_requirementsÚ pkg_resourcesZ RequirementÚparseÚ project_nameÚ ValueErrorr8r;r9Úfindr+rÚinfo) r5r@r<Z requirementsÚlineZreq_filerHÚreasonZsemi_posrrrrEUsJ ÿ          ÿrEcCsj|dkrtƒ}g}t|ƒD]J}t d|¡r,qt d|¡rN| t dd|¡¡qt d|¡r| |¡q|S)Nz (\s*#)|(\s*$)z \s*-[ef]\s+r)rA)r(r6r8r;r+r9)r5Zdependency_linksrLrrrÚparse_dependency_links•s     rNc@seZdZdZdZdd„ZdS)ÚInstallWithGitzœExtracts ChangeLog and AUTHORS from git then installs. This is useful for e.g. readthedocs where the package is installed and then docs built. rcCst|jƒtj |¡Sr)Ú _from_gitÚ distributionrÚrun©ÚselfrrrrR±s zInstallWithGit.runN©Ú__name__Ú __module__Ú __qualname__Ú__doc__Ú command_namerRrrrrrO¨srOc@seZdZdZdZdd„ZdS)Ú LocalInstallzÈRuns python setup.py install in a sensible manner. Force a non-egg installed in the manner of single-version-externally-managed, which allows us to install manpages and config files. rcCst|jƒtj |¡Sr)rPrQÚ du_installrrRrSrrrrRÀs zLocalInstall.runNrUrrrrr[¶sr[c@seZdZdZdZdd„ZdS)Ú TestrTestz&Make setup.py test do the right thing.ÚtestcCstj |¡dSr)r ÚTestrrRrSrrrrRÊsz TestrTest.runNrUrrrrr]Åsr]c@s4eZdZdZeZgZdZdd„Zdd„Zdd„Z d S) ÚLocalRPMVersionz:Output the rpm *compatible* version string of this packageZ rpm_versioncCs.t d¡|j ¡}tt |¡ ¡ ¡ƒdS)Nz[pbr] Extracting rpm version) rrKrQZget_nameÚprintrZ VersionInfoZsemantic_versionZ rpm_string)rTÚnamerrrrRÖs  zLocalRPMVersion.runcCsdSrrrSrrrÚinitialize_optionsÛsz"LocalRPMVersion.initialize_optionscCsdSrrrSrrrÚfinalize_optionsÞsz LocalRPMVersion.finalize_optionsN) rVrWrXrYZ descriptionZ user_optionsrZrRrcrdrrrrr`Ïsr`cCstjSr)r Ú have_testrrrrrreâsre)Úcommandsc@seZdZdZdZdd„ZdS)ÚNoseTestz)Fallback test runner if testr is a no-go.r^cCstj |¡dSr)rfÚ nosetestsrRrSrrrrRîsz NoseTest.runNrUrrrrrgésrgTcCstSr)Ú _have_noserrrrÚ have_noseøsrja5#PBR Generated from %(group)r import threading from %(module_name)s import %(import_target)s if __name__ == "__main__": import argparse import socket import wsgiref.simple_server as wss my_ip = socket.gethostbyname(socket.gethostname()) parser = argparse.ArgumentParser( description=%(import_target)s.__doc__, formatter_class=argparse.ArgumentDefaultsHelpFormatter) parser.add_argument('--port', '-p', type=int, default=8000, help='TCP port to listen on') args = parser.parse_args() server = wss.make_server('', args.port, %(invoke_target)s()) print("*" * 80) print("STARTING test server %(module_name)s.%(invoke_target)s") url = "http://%%s:%%d/" %% (my_ip, server.server_port) print("Available at %%s" %% url) print("DANGER! For testing only, do not use in production") print("*" * 80) server.serve_forever() else: application = None app_lock = threading.Lock() with app_lock: if application is None: application = %(invoke_target)s() z™# PBR Generated from %(group)r import sys from %(module_name)s import %(import_target)s if __name__ == "__main__": sys.exit(%(invoke_target)s()) )Zconsole_scriptsZ gui_scriptsZ wsgi_scriptsc csŠt d||¡}t ¡D]n\}}| |¡ ¡D]V\}}|jrHt|jƒdkrPtdƒ‚|t||j |jdd  |j¡d}|||fVq,qdS)z$Override entrypoints console_script.r)r?zBScript targets must be of the form 'func' or 'Class.class_method'.rÚ.)r:Ú module_nameZ import_targetZ invoke_targetN) rZget_script_headerÚENTRY_POINTS_MAPÚitemsZ get_entry_mapZattrsÚlenrIÚdictrlr#) ÚdistÚ executableÚ is_wininstÚheaderr:ÚtemplaterbZepZ script_textrrrÚoverride_get_script_args6s ürvc@seZdZdZdd„ZdS)Ú LocalDeveloprcCs:tjdkrtj ||¡S|js6t|ƒD]}|j|Žq&dS)NÚwin32)r!ÚplatformrÚinstall_wrapper_scriptsZexclude_scriptsrvÚ write_script)rTrqÚargsrrrrzLs   z$LocalDevelop.install_wrapper_scriptsN)rVrWrXrZrzrrrrrwHsrwc@seZdZdZdZdd„ZdS)ÚLocalInstallScriptsz(Intercepts console scripts entry_points.rc CsÐddl}| d¡|jjr,|jjj |¡ng|_|jr  ý ÿÿ zLocalInstallScripts.runNrUrrrrr}Tsr}c@s eZdZdZdd„Zdd„ZdS)ÚLocalManifestMakerz?Add any files that are in git and some standard sensible files.cCsdD]}|j |¡qdS)N)zinclude AUTHORSzinclude ChangeLogzexclude .gitignorezexclude .gitreviewzglobal-exclude *.pyc)ÚfilelistÚprocess_template_line)rTZ template_linerrrÚ_add_pbr_defaultssz$LocalManifestMaker._add_pbr_defaultscCs®|j d¡}tj |¡|j |j¡|j |j¡|j t   ¡¡t   |dd¡}|spt  ¡}|r†|j |¡ntj |j¡r†| ¡| d¡}| ¡|jjd|jddS)NÚpbrZskip_git_sdistZSKIP_GIT_SDISTrÚ*)Úprefix)rQÚget_option_dictr Ú add_defaultsr†r+ruÚmanifestr,r Zget_extra_filesr Zget_boolean_optionr Z_find_git_filesrr$r/Z read_manifestr€rˆZinclude_patternr)rTÚ option_dictZ should_skipZrcfilesr„rrrr‰s"  ÿ zLocalManifestMaker.add_defaultsN)rVrWrXrYrˆrrrrrr…|s r…c@seZdZdZdZdd„ZdS)Ú LocalEggInfozAOverride the egg_info command to regenerate SOURCES.txt sensibly.rcCsœtj |jd¡}tj |¡r2tj d¡s2dtjkr^t d¡t |j ƒ}||_ |  ¡|j |_ n:t d¡t ¡|_ t|dƒ ¡ d¡D]}|j  |¡q†dS) apGenerate SOURCES.txt only if there isn't one already. If we are in an sdist command, then we always want to update SOURCES.txt. If we are not in an sdist command, then it doesn't matter one flip, and is actually destructive. However, if we're in a git context, it's always the right thing to do to recreate SOURCES.txt z SOURCES.txtz.gitr z[pbr] Processing SOURCES.txtz"[pbr] Reusing existing SOURCES.txtr2r*N)rr$r#rr/r!ÚargvrrKr…rQrŽrRr†ÚFileListr3r4rr+)rTZmanifest_filenameZmmÚentryrrrÚ find_sources¢s   ÿþ     zLocalEggInfo.find_sourcesN)rVrWrXrYrZr”rrrrrsrcCs>| d¡}t ¡}|r t |¡}tj||dtj|ddS)Nr‰)rÚ changelog)r)rŒr Ú_iter_log_onelineZ_iter_changelogZwrite_git_changelogZgenerate_authors)rQrr•rrrrP»s   rPc@seZdZdZdZdd„ZdS)Ú LocalSDistz5Builds the ChangeLog and Authors files from VC first.r cCst|jƒtj |¡dSr)rPrQr rRrSrrrrRÉs zLocalSDist.runNrUrrrrr—Äsr—)ÚbuilddoccCstSr)Ú _have_sphinxrrrrÚ have_sphinxÛsršc sÔi‰|r|d}nd}t d|g|¡}tdƒ‰‡fdd„| d¡Dƒ}tƒ}|D]}| dd„| d ¡Dƒ¡qP‡fd d „}|d |d ƒ|d|dƒ|d|dƒ|d|dƒ|D]}t d|¡q°ˆ d d¡ˆS)aCalculate the sort of semver increment needed from git history. Every commit from HEAD to tag is consider for Sem-Ver metadata lines. See the pbr docs for their syntax. :return: a dict of kwargs for passing into SemanticVersion.increment. z..HEADZHEADrú sem-ver:cs*g|]"}| ¡ d¡r|ˆd… ¡‘qS)r›N)ÚlowerrCr)rrL)Ú header_lenrrr0îsÿz)_get_increment_kwargs..r*cSsg|] }| ¡‘qSrr)rÚsymbolrrrr0òsrcs||krdˆ|<| |¡dS)NT)Údiscard)ržÚsymbolsZimpact)ÚresultrrÚ_handle_symbolôsz-_get_increment_kwargs.._handle_symbolZbugfixZpatchZfeatureÚminorZ deprecationz api-breakÚmajorz[pbr] Unknown Sem-Ver symbol %rN) r Ú_run_git_commandrorÚsetÚupdaterrKÚpop) Úgit_dirÚtagZ version_specr•rfr rr¢ržr)rr¡rÚ_get_increment_kwargsßs&       r«c Csˆtj|d}d}t|ƒD]f\}\}}}tƒ}t|ƒD]0}z| tj |¡¡Wq4t k rbYq4Xq4|rt |ƒ  ¡|fSqd|fS)zÅReturn the commit data about the most recent tag. We use git-describe to find this out, but if there are no tags then we fall back to counting commits since the beginning of time. )r©rr)) r r–Ú enumerater¦rÚaddrÚSemanticVersionÚfrom_pip_stringÚ ExceptionÚmaxÚrelease_string)r©r•Z row_countZignoredZtag_setZ version_tagsrªrrrÚ_get_revno_and_last_tags  r³cCs˜t|ƒ\}}tj |pd¡}|dkr*|}n|jft||ƒŽ}|dk r`||kr`tdt||dƒ‚|dkrl|S| |¡}|dk r”| |¡}||kr”|S|S)a¥Calculate a version from a target version in git_dir. This is used for untagged versions only. A new version is calculated as necessary based on git metadata - distance to tags, current hash, contents of commit messages. :param git_dir: The git directory we're working from. :param target_version: If None, the last tagged version (or 0 if there are no tags yet) is incremented as needed to produce an appropriate target version following semver rules. Otherwise target_version is used as a constraint - if semver rules would result in a newer version then an exception is raised. :return: A semver version object. Ú0rNzRgit history requires a target version of %(new)s, but target version is %(target)s)ÚnewÚtarget) r³rr®r¯Z incrementr«rIrpZto_dev)r©Útarget_versionrªZdistanceZ last_semverZ new_versionZnew_devZ target_devrrrÚ_get_version_from_git_targets* ÿ þÿ  r¸cCsšt ¡}|rvz,tjddg|dd dd¡}tj |¡}Wn*tk rb|rZtj |¡}nd}YnXt||ƒ}|  ¡Szt ƒWSt k r”YdSXdS) ažCalculate a version string from git. If the revision is tagged, return that. Otherwise calculate a semantic version description of the tree. The number of revisions since the last tag is included in the dev counter in the version for untagged versions. :param pre_version: If supplied use this as the target version rather than inferring one from the last tag + commit messages. Zdescribez --exact-matchT)Zthrow_on_errorú-rkNr)) r Z_run_git_functionsr¥Úreplacerr®r¯r°r¸r²ZunicodeÚ NameError)Ú pre_versionr©Ztaggedr·r¡rrrÚ_get_version_from_git>s0 þþÿ  r½c CsŒddg}i}|D]Z}zt|dƒ}Wnttfk r>YqYnXzt |¡}Wqtjk rhYqYqXq| dd¡|kr€dS| dd¡S)z¾Get the version from package metadata if present. This looks for PKG-INFO if present (for sdists), and if not looks for METADATA (for wheels) and failing that will return None. zPKG-INFOZMETADATAr2ÚNameNZVersion)r3ÚIOErrorÚOSErrorÚemailZmessage_from_fileZ MessageErrorr)Ú package_nameZpkg_metadata_filenamesZ pkg_metadataÚfilenameZpkg_metadata_filerrrÚ_get_version_from_pkg_metadatads  rÄcCsdtj dtj dd¡¡}|r |St|ƒ}|r0|St|ƒ}tjddkrP| d¡}|rX|Stdƒ‚dS)aGet the version of the project. First, try getting it from PKG-INFO or METADATA, if it exists. If it does, that means we're in a distribution tarball or that install has happened. Otherwise, if there is no PKG-INFO or METADATA file, pull the version from git. We do not support setup.py version sanity in git archive tarballs, nor do we support packagers directly sucking our git repo into theirs. We expect that a source tarball be made from our git repo - or that if someone wants to make a source tarball from a fork of our repo with additional tags in it that they understand and desire the results of doing that. :param pre_version: The version field from setup.cfg - if set then this version will be the next release. Z PBR_VERSIONZOSLO_PACKAGE_VERSIONNrr?zutf-8zŠVersioning for this project requires either an sdist tarball, or access to an upstream git repository. Are you sure that git is installed?) rrrrÄr½r!r"Úencoder°)rÂr¼rrrrÚ get_version|s þ rÆ)NF)N)N)N)LrYZ __future__rZdistutils.commandrr\rƒrrÁrr8r!rFZ setuptoolsZsetuptools.commandrrrrr r‰r r r Z pbr.pbr_jsonr rr&ZTEST_REQUIREMENTS_FILESr(r.r1r6rErNrOr[r_r]ZCommandr`reZnoserfrhrgriÚ ImportErrorrjZ _wsgi_textZ _script_textrmr$Únormpathrrrvrwr}Zmanifest_makerr…rrPr—r˜r™Z LocalBuildDocZLocalBuildLatexršr«r³r¸r½rÄrÆZpbr_jsonZwrite_pbr_jsonrrrrÚs’                 @     &ý ÿ  (!     %% & )