Commit c3f53c0f authored by Dominik George's avatar Dominik George

New upstream version 0.3.0

parents
*.py[cod]
__pycache__
# C extensions
*.so
# Packages
*.egg
*.egg-info
dist
build
eggs
parts
var
sdist
develop-eggs
.installed.cfg
lib
lib64
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
nosetests.xml
# Mr Developer
.mr.developer.cfg
.project
.pydevproject
# Backup versions of files [Kw’s scheme]
o.*
# GitHub token file
.pypt/gh-token
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# AURvm client script
# Usage: ./aurvm_client.py $PROJECT $AUR_PKGNAME $AUR_PKGNAME_GIT $version use_git[true|false]
# Part of the Python Project Template.
# Copyright © 2013-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author of this software nor the names of
# contributors to this software may be used to endorse or promote
# products derived from this software without specific prior written
# consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import base64
import io
import json
import subprocess
import sys
try:
_, project, aur_pkgname, aur_pkgname_git, version, use_git = sys.argv
except ValueError:
sys.stderr.write("Usage: ./aurvm_client.py $PROJECT $AUR_PKGANME $AUR_PKGNAME_GIT $version use_git[true|false]\n")
sys.exit(1)
use_git = True if use_git == 'true' else False
if use_git:
gitver = subprocess.check_output(r"git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g'", shell=True)
gitver = gitver.decode('utf-8').strip()
else:
gitver = None
with io.open('PKGBUILD', 'r', encoding='utf-8') as fh:
pkgbuild = fh.read()
data = json.dumps({
'project': project,
'aur_pkgname': aur_pkgname,
'aur_pkgname_git': aur_pkgname_git,
'version': version,
'use_git': use_git,
'gitver': gitver,
'pkgbuild': pkgbuild,
'_api': '2'
}, ensure_ascii=True, sort_keys=True).encode('utf-8')
print(base64.b64encode(data).decode('utf-8'))
Python Project Template is licensed under a BSD-like license. You are free to
relicense your code to another open source license. If you want to apply a
commercial (a.k.a. proprietary) license, you must contact me first.
HOWEVER, the following files must remain under the BSD license:
* /.pypt/commitlog
* /.pypt/ghrel
* /.pypt/localegen
* /.pypt/PYPT-UPDATE
* /.pypt/README.rst
* /.pypt/LICENSE.PyPT
* /docs/CONTRIBUTING.rst
* /CONTRIBUTING.rst
* /release
The README file for PyPT MAY NOT be relicensed.
The actual license is: (the name may have been replaced by yours if you did the
Getting up to speed in 16 easy steps, it was mine originally, and the
version in .pypt/ should reflect that.)
LICENSE
-------
Copyright © 2013-2018, Chris Warrick.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions, and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author of this software nor the names of
contributors to this software may be used to endorse or promote
products derived from this software without specific prior written
consent.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#!/usr/bin/env python
# AURvm client script
# Usage: ./aurvm_client.py $PROJECT $AUR_PKGNAME $AUR_PKGNAME_GIT $version use_git[true|false]
# Part of the Python Project Template.
# Copyright © 2013-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author of this software nor the names of
# contributors to this software may be used to endorse or promote
# products derived from this software without specific prior written
# consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import base64
import io
import json
import subprocess
import sys
try:
_, project, aur_pkgname, aur_pkgname_git, version, use_git = sys.argv
except ValueError:
print("Usage: ./aurvm_client.py $PROJECT $AUR_PKGANME $AUR_PKGNAME_GIT $version use_git[true|false]")
use_git = True if use_git == 'true' else False
if use_git:
gitver = subprocess.check_output(r"git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g'", shell=True)
gitver = gitver.decode('utf-8').strip()
else:
gitver = None
with io.open('PKGBUILD', 'r', encoding='utf-8') as fh:
pkgbuild = fh.read()
data = json.dumps({
'project': project,
'aur_pkgname': aur_pkgname,
'aur_pkgname_git': aur_pkgname_git,
'version': version,
'use_git': use_git,
'gitver': gitver,
'pkgbuild': pkgbuild,
'_api': '2'
}, ensure_ascii=True, sort_keys=True).encode('utf-8')
print(base64.b64encode(data).decode('utf-8'))
#!/bin/sh
echo "AURvm OK"
#!/usr/bin/env python3
# AURvm host script
# Usage: base64-encoded JSON on stdin
# Part of the Python Project Template.
# Copyright © 2013-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author of this software nor the names of
# contributors to this software may be used to endorse or promote
# products derived from this software without specific prior written
# consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
import base64
import io
import json
import os
import subprocess
import sys
BASEDIR = os.path.expanduser('~/git/aur-pkgbuilds')
def commitaur(msg):
with open('.SRCINFO', 'wb') as fh:
fh.write(subprocess.check_output(['makepkg', '--printsrcinfo']))
subprocess.check_call(['git', 'add', '.'])
subprocess.check_call(['git', 'commit', '-asm', msg])
subprocess.check_call(['git', 'push', '-u', 'origin', 'master'])
data = base64.b64decode(sys.stdin.read().encode('utf-8'))
data = json.loads(data.decode('utf-8'))
if data['_api'] != 2:
print("API version does not match")
msg = data['project'] + ' v' + data['version']
sys.stderr.write("[host] Updating AUR packages...\n")
sys.stderr.flush()
os.chdir(BASEDIR)
os.chdir(data['aur_pkgname'])
with io.open('PKGBUILD', 'w', encoding='utf-8') as fh:
fh.write(data['pkgbuild'])
commitaur(msg)
os.chdir(BASEDIR)
if data['use_git']:
os.chdir(data['aur_pkgname_git'])
subprocess.check_call(["sed", "s/pkgver=.*/pkgver=" + data['gitver'] + "/", "PKGBUILD", "-i"])
commitaur(msg)
os.chdir(BASEDIR)
subprocess.check_call(['./UPDATE-REQUIREMENTS.py'])
subprocess.check_call(['git', 'commit', '-asm', msg])
subprocess.check_call(['git', 'push'])
sys.stderr.write("[host] Done!\n")
sys.stderr.flush()
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Kw’s Release Tools/Python Project Template
# Commit and Changelog Parser
# Copyright © 2013-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author of this software nor the names of
# contributors to this software may be used to endorse or promote
# products derived from this software without specific prior written
# consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Parse commits and changelogs for PyPT.
Usage: .pypt/commitlog FILE BASEDIR NEWVERSION, where
FILE is the path to the CMFN file to parse,
BASEDIR is the project directory,
NEWVERSION is the new version number.
All paths should be absolute.
"""
import argparse
import re
import sys
from os.path import join as pjoin
# Stolen from textwrap in Python 3.4.3 with PEP257 fixes
def indent(text, prefix, predicate=None):
"""Add 'prefix' to the beginning of selected lines in 'text'.
If 'predicate' is provided, 'prefix' will only be added to the lines
where 'predicate(line)' is True. If 'predicate' is not provided,
it will default to adding 'prefix' to all non-empty lines that do not
consist solely of whitespace characters.
"""
if predicate is None:
def predicate(line):
return line.strip()
def prefixed_lines():
for line in text.splitlines(True):
yield (prefix + line if predicate(line) else line)
return ''.join(prefixed_lines())
def main():
"""commitlog main function."""
parser = argparse.ArgumentParser(
description="Commit and Changelog Parser "
"(part of Chris Warrick's Python Project Template)")
parser.add_argument('filename', metavar='FILE', nargs=1,
help='File to parse')
parser.add_argument('basedir', metavar='BASEDIR', nargs=1,
help='Project directory')
parser.add_argument('new_version', metavar='NEWVERSION', nargs=1,
help='New version (X.Y.Z)')
args = parser.parse_args()
# nargs gets you lists, not strings
filename = args.filename[0]
basedir = args.basedir[0]
new_version = args.new_version[0]
with open(filename) as fh:
e = re.findall('#~ (C[A-Z]+) MESSAGE START ~#\n(.*?)\n#~ (C[A-Z]+) MESSAGE '
'END ~#', fh.read(), flags=re.S)
for i in e:
i = list(i)
if i[0] != i[2]:
print('ERROR: mismatched tags')
return 1
else:
if i[0] == 'COMMIT':
with open(filename + '-commit', 'w') as fh:
fh.write(i[1])
elif i[0] == 'CHANGELOG':
with open(pjoin(basedir, 'docs', 'CHANGELOG.rst')) as fh:
currentfile = fh.read()
# A bit fragile...
currentver = re.search(':Version: (.*)',
currentfile).groups()[0]
clog = indent(i[1], 4 * ' ')
with open(pjoin(basedir, 'docs', 'CHANGELOG.rst'), 'w') as fh:
fh.write(currentfile.replace(
'\n' + currentver,
'\n{0}\n{1}\n\n{2}'.format(
new_version, clog, currentver)))
if __name__ == '__main__':
sys.exit(main())
#!/bin/bash
# Human-friendly project name.
PROJECT="upass"
# Computer-friendly project name, [a-z0-9_\-]
PROJECTLC="upass"
# GitHub username.
GITUSER="Kwpolska"
# Git repository name. Using $PROJECTLC is recommended.
GITREPO=$PROJECTLC
# Locale type. One of:
# none Do not generate nor use any locales.
# gettext Use GNU gettext (gettext module).
# gettext-tx Use GNU gettext (gettext module) and send to Transifex.
# pyqt4 Use the Qt locale tools (stock Qt + PyQt4).
# pyqt4-tx Use the Qt locale tools (stock Qt + PyQt4) and send to Transifex.
# pyside Use the Qt locale tools (stock Qt + PySide).
# pyside-tx Use the Qt locale tools (stock Qt + PySide) and send to Transifex.
LOCALETYPE="none"
# Python versions supported.
PYTHON2=1
PYTHON3=1
# AUR package names. You still need to change PKGBUILDs!
AUR_PKGNAME=$PROJECTLC
AUR_PKGNAME_GIT=$PROJECTLC"-git"
# Whether or not to create AUR -git packages. (true/false)
AUR_GIT_PACKAGE="true"
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
# Kw’s Release Tools/Python Project Template
# GitHub Release Creator
# Copyright © 2013-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author of this software nor the names of
# contributors to this software may be used to endorse or promote
# products derived from this software without specific prior written
# consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
Create GitHub releases out of changelogs.
Usage: .pypt/commitlog FILE BASEDIR REPOSITORY TAG, where
FILE is the path to the file to use, which can be
a plain .md file or a CMFN file,
BASEDIR is the project directory,
REPOSITORY is the full GitHub repository name (user/repo),
TAG is the tag to write to.
All paths should be absolute.
"""
import argparse
import json
import re
import requests
import sys
from os.path import join as pjoin
def main():
"""ghrel main function."""
parser = argparse.ArgumentParser(
description="GitHub Release Creator "
"(part of Chris Warrick's Python Project Template)")
parser.add_argument('filename', metavar='FILE', nargs=1,
help='File to parse (Markdown or commitlog)')
parser.add_argument('basedir', metavar='BASEDIR', nargs=1,
help='Project directory (must contain .pypt/gh-token)')
parser.add_argument('repo', metavar='REPOSITORY', nargs=1,
help='GitHub repository (owner/repo)')
parser.add_argument('tag', metavar='TAG', nargs=1,
help='Tag to create release for (vX.Y.Z)')
args = parser.parse_args()
# nargs gets you lists, not strings
filename = args.filename[0]
basedir = args.basedir[0]
repo = args.repo[0]
tag = args.tag[0]
with open(pjoin(basedir, '.pypt', 'gh-token')) as fh:
token = fh.read().strip()
headers = {
'User-Agent': 'Kwpolska/python-project-template',
'Authorization': 'token ' + token,
}
with open(filename) as fh:
fdata = fh.read()
e = re.findall(
'#~ CHANGELOG MESSAGE START ~#\n(.*?)\n'
'#~ CHANGELOG MESSAGE END ~#',
fdata, flags=re.S)
if e:
# parse as a CMFN file, replace backticks (reST -> Markdown)
message = e[0].replace('``', '`')
else:
# parse as a plain Markdown file
message = fdata
r = requests.post(
'https://api.github.com/repos/{0}/releases'.format(repo),
data=json.dumps({'tag_name': tag, 'body': message}),
headers=headers)
if r.status_code == 201:
print("GitHub Release created: {0}".format(r.json()['html_url']))
else:
print("GitHub Release failed: {0}".format(r.text))
return 1
if __name__ == '__main__':
sys.exit(main())
#!/bin/zsh
. .pypt/config
# To change default, move the ` || "$rln" == ""` condition wherever you desire
# and change the capital letter in the prompt
echo -n "Update AUR packages? [Remotely/locally/no] "
read rln
if [[ "$rln" == "N" || "$rln" == "n" ]]; then
exit 0
fi
if [[ "$rln" == "L" || "$rln" == "l" ]]; then
echo "Updating AUR packages..."
gitver=$(git describe --long | sed -E 's/([^-]*-g)/r\1/;s/-/./g;s/^v//g')
cp PKGBUILD ~/git/aur-pkgbuilds/$AUR_PKGNAME/PKGBUILD
cd ~/git/aur-pkgbuilds
. ~/git/aur-pkgbuilds/aur.zsh
cd $AUR_PKGNAME
commitaur "$PROJECT v$version"
if [[ "$AUR_GIT_PACKAGE" == "true" ]]; then
cd $AUR_PKGNAME_GIT
sed "s/pkgver=.*/pkgver=$gitver/" PKGBUILD -i
commitaur "$PROJECT v$version"
fi
./UPDATE-REQUIREMENTS.py
git commit -asm "$PROJECT v$version"
git push
echo "Done!"
fi
if [[ "$rln" == "R" || "$rln" == "r" || "$rln" == "" ]]; then
avout=""
echo "[local] Attempting to remote into Arch Linux VM (ssh arch)..."
while [[ "$avout" != "AURvm OK" ]]; do
echo "[local] Sending heartbeat..."
avout=$(ssh arch git/aur-pkgbuilds/aurvm_heartbeat.sh)
done
echo "[local] Sending data..."
.pypt/AURvm/aurvm_client.py $PROJECT $AUR_PKGNAME $AUR_PKGNAME_GIT $version $AUR_GIT_PACKAGE | ssh arch git/aur-pkgbuilds/aurvm_host.py
echo "[local] Done!"
fi
#!/bin/zsh
. .pypt/config
#!/bin/zsh
# Kw’s Release Tools/Python Project Template
# Locale Generator
# Copyright © 2013-2018, Chris Warrick.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions, and the following disclaimer.
#
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions, and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# 3. Neither the name of the author of this software nor the names of
# contributors to this software may be used to endorse or promote
# products derived from this software without specific prior written
# consent.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
. .pypt/config
case "$LOCALETYPE" in
'gettext' | 'gettext-tx')
version=$(cat setup.py | grep 'version=' | sed -e 's/.*version=.//g' -e 's/.,$//g')
date=$(date '+%Y-%m-%d')
datel=$(date '+%Y-%m-%d %H:%M%z')
datep=$(date '+%Y%m%d')
xgettext -c ./$PROJECTLC/**/*.py localeprovider.py -o ./messages.pot
sed '1,+17d' ./messages.pot > ./messages.pot.tmp
pot='# '$PROJECT' pot file.
# Copyright © 2018, Chris Warrick.
# This file is distributed under the same license as the '$PROJECT' package.
# Chris Warrick <chris@chriswarrick.com>, 2016.
#
msgid ""
msgstr ""
"Project-Id-Version: #version\\n"
"Report-Msgid-Bugs-To: Chris Warrick <chris@chriswarrick.com>\\n"
"POT-Creation-Date: #datel\\n"
"PO-Revision-Date: #datel\\n"
"Last-Translator: Chris Warrick <chris@chriswarrick.com>\\n"
"Language-Team: Chris Warrick <chris@chriswarrick.com>\\n"
"Language: en\\n"
"MIME-Version: 1.0\\n"
"Content-Type: text/plain; charset=UTF-8\\n"
"Content-Transfer-Encoding: 8bit\\n"'
echo $pot > messages.pot
cat ./messages.pot.tmp >> messages.pot
rm ./messages.pot.tmp
sed "s/#version/$version/g" messages.pot -i
sed "s/#datel/$datel/g" messages.pot -i
if [[ "$LOCALETYPE" == "gettext-tx" ]]; then
tx push -s
tx pull
fi
for i in ./locale/*; do
language=$(basename $i)
podir="./locale/$language/LC_MESSAGES"
popath="./locale/$language/LC_MESSAGES/$PROJECTLC.po"
sed 's/\"Project-Id-Version: .*/\"Project-Id-Version: '$version'\\n\"/' $popath -i
msgmerge $popath messages.pot -o $popath
fuzzy=$(cat $popath | grep -c '#, fuzzy')
empty=$(cat $popath | pcregrep -cM 'msgstr ""\n$')
if [ $fuzzy != '0' ]; then
echo "WARNING: $fuzzy fuzzy strings in language $language."
fi
if [ $empty != '0' ]; then
echo "WARNING: $empty empty strings in language $language."
fi
msgfmt -o $podir/$PROJECTLC.mo $popath
done
;;
'pyqt4' | 'pyqt4-tx')
pylupdate4 -verbose $PROJECTLC.pro
if [[ "$LOCALETYPE" == "pyqt4-tx" ]]; then
tx push -s
tx pull
fi
for i in ./locale/*.ts; do
# pylupdate4 is dumb and mangles encodings
sed -i -e 's|filename="|filename="../|g' -e \
's|&#xe2;&#x80;&#x9c;|“|g' -e 's|&#xe2;&#x80;&#x9d;|”|g' -e \
's|&#xe2;&#x80;&#x98;|‘|g' -e 's|&#xe2;&#x80;&#x99;|’|g' -e \
's|&#xe2;&#x80;&#xa6;|…|g' -e 's|&#xe2;&#x80;&#x93;|–|g' -e \
's|&#xe2;&#x80;&#x94;|—|g' $i
done
lrelease $PROJECTLC.pro
pyrcc4 -py2 $PROJECTLC.qrc -o $PROJECTLC/ui/resources2.py
pyrcc4 -py3 $PROJECTLC.qrc -o $PROJECTLC/ui/resources3.py