PK!w jinja2_git.py# -*- coding: utf-8 -*- import subprocess # noqa: S404 from jinja2 import nodes from jinja2.ext import Extension class GitExtension(Extension): """This class represents jinja2 extension to render current commit hash.""" tags = {'gitcommit'} def parse(self, parser): """Main method to render data into the template.""" lineno = next(parser.stream).lineno if parser.stream.skip_if('name:short'): parser.stream.skip(1) short = parser.parse_expression() else: short = nodes.Const(False) # noqa: WPS425 commit = self.call_method('_commit_hash', [short], [], lineno=lineno) return nodes.Output([commit], lineno=lineno) def _commit_hash(self, short): command = ['git', 'rev-parse', 'HEAD'] if short: command.insert(2, '--short') output = subprocess.check_output(command) # noqa: S603 return output.decode('utf-8').strip() PK!SE//"jinja2_git-1.0.0.dist-info/LICENSEMIT License Copyright (c) 2017 Nikita Sobolev Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HڽTU jinja2_git-1.0.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!HC #jinja2_git-1.0.0.dist-info/METADATAVms6_Ε&6/yek G]"ۊ--W!ޕ arצaHy5뷄 ʢemCRCsqEԶedIk (I dǑ0]ġAҧ'+=8E4Ola)̝}gNdbyjGm| FGʁHMa5GK#$ژPN>ZCj?7,K$CI4X&jhę82a \+ZR΢&3F(J\J"(M<`Jb8"+9[-~,4Y I Q]|a8CKDުo7Nߌ8{ WtTYl9%b5%2:PWRQđlܯ1ѿ%RcPɚ.[EIn]C~<+z) \aPfY=qB"C,_l6cu UAҎ#PmXBIo1 df5_i]_ֿFmLg-wFMp7nxipdzpYq6N~E9./j{ʚ߭/TD]zV{ 柛Vw؛nzq{C:OΕZ^dF_:ÎeMFOVչͪuY2iWm;MNZ|<%|չؚr;$Pq5~#ǯ(/lB8v:RWވ5't~ Wm2;Y/xS*24kZW=҅\KKa󤆛g/N'ؘߋY`㿃+$.i|gln$ 7&XM}*Pv!xK~\q J&>sv=(!,DO-3%|kszq[P'@}Mt֝CfzzK˄'MgYN}`\JŁ0_#fTY.s sf)dZe48F"3%A]!ٻ0(uDq @Co٩T=pg cCCϱwc*[עC MH96<` PK!w jinja2_git.pyPK!SE//"jinja2_git-1.0.0.dist-info/LICENSEPK!HڽTU gjinja2_git-1.0.0.dist-info/WHEELPK!HC #jinja2_git-1.0.0.dist-info/METADATAPK!HeAZw!Wjinja2_git-1.0.0.dist-info/RECORDPKy