ϪfG"dZddlZddlmZmZmZddlmZddlm Z m Z ddl m Z dZ Gdd e Ze eGd d Zd ZGd dZdZdZGddeZdZGddeZy)aL Twisted's automated release system. This module is only for use within Twisted's release system. If you are anyone else, do not use it. The interface and behaviour will change without notice. Only Linux is supported by this code. It should not be used by any tools which must run on multiple platforms (eg the setup.py script). N)STDOUTCalledProcessError check_output)Dict) Interface implementer)execfilec ,t|d<t|fi|S)aExecute a vector of arguments. This is a wrapper around L{subprocess.check_output}, so it takes the same arguments as L{subprocess.Popen} with one difference: all arguments after the vector must be keyword arguments. @param args: arguments passed to L{subprocess.check_output} @param kwargs: keyword arguments passed to L{subprocess.check_output} @return: command output @rtype: L{bytes} stderr)rr)argskwargss 9/usr/lib/python3/dist-packages/twisted/python/_release.py runCommandrsF8  ' ''c(eZdZdZdZdZdZdZy) IVCSCommandz( An interface for VCS commands. cy)z Ensure that C{path} is a working directory of this VCS. @type path: L{twisted.python.filepath.FilePath} @param path: The path to check. Npaths rensureIsWorkingDirectoryz$IVCSCommand.ensureIsWorkingDirectory-rcy) Return the Git status of the files in the specified path. @type path: L{twisted.python.filepath.FilePath} @param path: The path to get the status from (can be a directory or a file.) Nrrs r isStatusCleanzIVCSCommand.isStatusClean5rrcy)z Remove the specified path from a the VCS. @type path: L{twisted.python.filepath.FilePath} @param path: The path to remove from the repository. Nrrs rremovezIVCSCommand.remove>rrcy)a Export the content of the VCSrepository to the specified directory. @type fromDir: L{twisted.python.filepath.FilePath} @param fromDir: The path to the VCS repository to export. @type exportDir: L{twisted.python.filepath.FilePath} @param exportDir: The directory to export the content of the repository to. This directory doesn't have to exist prior to exporting the repository. NrfromDir exportDirs rexportTozIVCSCommand.exportToFrrN)__name__ __module__ __qualname____doc__rrrr"rrrrr(s     rrcPeZdZdZedZedZedZedZy) GitCommandzJ Subset of Git commands to release Twisted from a Git repository. c tddg|jy#ttf$rt |jdwxYw)z Ensure that C{path} is a Git working directory. @type path: L{twisted.python.filepath.FilePath} @param path: The path to check. gitz rev-parse)cwdz( does not appear to be a Git repository.N)rrrOSErrorNotWorkingDirectoryrs rrz#GitCommand.ensureIsWorkingDirectoryZsJ  {+ ;"G, %99+EF  s (Ac\tdd|jddgj}|dk(S)rr*-Cstatusz--shortr)rrstrip)rr0s rrzGitCommand.isStatusCleanis0UD$))XyIJPPR}rcTtdd|jd|jgy)z Remove the specified path from a Git repository. @type path: L{twisted.python.filepath.FilePath} @param path: The path to remove from the repository. r*r/rmN)rdirnamerrs rrzGitCommand.removeus! E4tyyABrc Xtdd|jdddd|jdzgy) a Export the content of a Git repository to the specified directory. @type fromDir: L{twisted.python.filepath.FilePath} @param fromDir: The path to the Git repository to export. @type exportDir: L{twisted.python.filepath.FilePath} @param exportDir: The directory to export the content of the repository to. This directory doesn't have to exist prior to exporting the repository. r*r/zcheckout-indexz--allz--forcez--prefix/N)rrrs rr"zGitCommand.exportTos8   $  rN) r#r$r%r& staticmethodrrrr"rrrr(r(TsY    CC  rr(c tj|tS#ttf$rYnwxYwtd|j)a Detect the VCS used in the specified directory and return a L{GitCommand} if the directory is a Git repository. If the directory is not git, it raises a L{NotWorkingDirectory} exception. @type directory: L{FilePath} @param directory: The directory to detect the VCS used from. @rtype: L{GitCommand} @raise NotWorkingDirectory: if no supported VCS can be found from the specified directory. z!No supported VCS can be found in )r(rr-r,r directorys rgetRepositoryCommandr;sL ++I6  )     A)..AQR SSs //c(eZdZdZdZdefdZdZy)ProjectaC A representation of a project that has a version. @ivar directory: A L{twisted.python.filepath.FilePath} pointing to the base directory of a Twisted-style Python package. The package should contain a C{_version.py} file and a C{newsfragments} directory that contains a C{README} file. c||_y)Nr9)selfr:s r__init__zProject.__init__s "rreturncN|jjd|jdS)N()) __class__r#r:)r?s r__repr__zProject.__repr__s%..))*!DNN+=Q??rci}|j}|sf|jdk(r td|jdk(s|j }n%t |j dj||sf|dS)z @return: A L{incremental.Version} specifying the version number of the project based on live python modules. r6zNot inside a Twisted project.twistedz _version.py __version__)r:r Exceptionbasenameparentr child)r? namespacer:s r getVersionzProject.getVersionsw (* NN ~~$ ?@@'')Y6%,,. 7< 1 K   6SZ+- .D % % %%rceZdZdZy)r-zf Raised when a directory does not appear to be a repository directory of a supported VCS. Nrmrrrr-r-srr-)r&r\ subprocessrrrtypingrzope.interfacerrtwisted.python.compatr rrr(r;r=rYrjrJrlr{r-rrrrs  ??1* ( ) )) X [D D D NT0((B  !y &8)r