mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Dont use a binary for building translations
This commit is contained in:
parent
168c75d5d1
commit
5203651af1
15
.github/workflows/ci.yml
vendored
15
.github/workflows/ci.yml
vendored
@ -39,25 +39,24 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
CI: 'true'
|
CI: 'true'
|
||||||
steps:
|
steps:
|
||||||
- name: Install calibre dependencies
|
- name: Prepare the container
|
||||||
run: |
|
run: |
|
||||||
set -xe
|
|
||||||
useradd -m ci
|
|
||||||
pacman -Syu --noconfirm
|
pacman -Syu --noconfirm
|
||||||
pacman -S --noconfirm --needed base-devel sudo git sip5 pyqt-builder chmlib icu jxrlib hunspell libmtp libusb libwmf optipng podofo python-apsw python-beautifulsoup4 python-cssselect python-css-parser python-dateutil python-dbus python-dnspython python-dukpy python-feedparser python-html2text python-html5-parser python-lxml python-markdown python-mechanize python-msgpack python-netifaces python-unrardll python-pillow python-psutil python-pygments python-pyqt5 python-regex python-zeroconf python-pyqtwebengine qt5-x11extras qt5-svg qt5-imageformats udisks2 hyphen python-pychm python-pycryptodome speech-dispatcher
|
pacman -S --noconfirm tar
|
||||||
|
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
fetch-depth: 10
|
fetch-depth: 10
|
||||||
|
|
||||||
|
- name: Install calibre dependencies
|
||||||
|
run: setup/arch-ci.sh
|
||||||
|
|
||||||
- name: Bootstrap calibre
|
- name: Bootstrap calibre
|
||||||
run: |
|
run: runuser -u ci -- python setup.py bootstrap --ephemeral
|
||||||
chown -R ci:users $GITHUB_WORKSPACE
|
|
||||||
runuser -u ci -- python setup.py bootstrap --ephemeral
|
|
||||||
|
|
||||||
- name: Test calibre
|
- name: Test calibre
|
||||||
run: |
|
run: |
|
||||||
|
set -xe
|
||||||
runuser -u ci -- python setup.py test
|
runuser -u ci -- python setup.py test
|
||||||
runuser -u ci -- python setup.py test_rs
|
runuser -u ci -- python setup.py test_rs
|
||||||
chmod +777 .git .git/config
|
|
||||||
|
32
.github/workflows/translations.yml
vendored
32
.github/workflows/translations.yml
vendored
@ -9,30 +9,32 @@ jobs:
|
|||||||
name: Update translations on Transifex
|
name: Update translations on Transifex
|
||||||
if: github.repository == 'kovidgoyal/calibre'
|
if: github.repository == 'kovidgoyal/calibre'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: 'archlinux/base:latest'
|
||||||
|
env:
|
||||||
|
CI: 'true'
|
||||||
steps:
|
steps:
|
||||||
|
- name: Prepare the container
|
||||||
|
run: |
|
||||||
|
pacman -Syu --noconfirm
|
||||||
|
pacman -S --noconfirm tar
|
||||||
|
|
||||||
- name: Checkout source code
|
- name: Checkout source code
|
||||||
uses: actions/checkout@master
|
uses: actions/checkout@master
|
||||||
with:
|
with:
|
||||||
fetch-depth: 2
|
fetch-depth: 2
|
||||||
|
|
||||||
- name: Checkout translations
|
- name: Install calibre dependencies
|
||||||
uses: actions/checkout@master
|
run: setup/arch-ci.sh
|
||||||
with:
|
|
||||||
repository: 'kovidgoyal/calibre-translations'
|
|
||||||
path: 'translations'
|
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@master
|
|
||||||
with:
|
|
||||||
python-version: 3.8
|
|
||||||
|
|
||||||
- name: Install translations dependencies
|
- name: Install translations dependencies
|
||||||
run:
|
run: python -m pip install transifex-client
|
||||||
python -m pip install 'urllib3<1.26' transifex-client sphinx
|
|
||||||
|
- name: Bootstrap calibre
|
||||||
|
run: runuser -u ci -- python setup.py bootstrap --ephemeral
|
||||||
|
|
||||||
- name: Update translations
|
- name: Update translations
|
||||||
env:
|
env:
|
||||||
tx: ${{ secrets.tx }}
|
tx: ${{ secrets.tx }}
|
||||||
CI: "true"
|
run: |
|
||||||
run:
|
runuser -u ci -- python setup/unix-ci.py pot
|
||||||
python setup/unix-ci.py pot
|
|
||||||
|
@ -12,7 +12,6 @@ from functools import partial
|
|||||||
j, d, a = os.path.join, os.path.dirname, os.path.abspath
|
j, d, a = os.path.join, os.path.dirname, os.path.abspath
|
||||||
BASE = d(a(__file__))
|
BASE = d(a(__file__))
|
||||||
SPHINX_BUILD = ['sphinx-build']
|
SPHINX_BUILD = ['sphinx-build']
|
||||||
is_ci = os.environ.get('CI') == 'true'
|
|
||||||
|
|
||||||
sys.path.insert(0, d(BASE))
|
sys.path.insert(0, d(BASE))
|
||||||
from setup import __appname__, __version__
|
from setup import __appname__, __version__
|
||||||
@ -71,12 +70,6 @@ def build_manual(language, base):
|
|||||||
|
|
||||||
def build_pot(base):
|
def build_pot(base):
|
||||||
cmd = SPHINX_BUILD + ['-b', 'gettext', '-t', 'online', '-t', 'gettext', '.', base]
|
cmd = SPHINX_BUILD + ['-b', 'gettext', '-t', 'online', '-t', 'gettext', '.', base]
|
||||||
if is_ci:
|
|
||||||
sp = eval(subprocess.check_output(['python', '-c', 'import sphinx; print(sphinx.__path__)']).decode('utf-8'))
|
|
||||||
code = f'import sys, os; sys.path += [{os.path.dirname(sp[0])!r}]; from sphinx.cmd.build import main; main({cmd[1:]!r})'
|
|
||||||
os.environ['CALIBRE_DEVELOP_FROM'] = j(d(BASE), 'src')
|
|
||||||
print('Running with calibre src:', os.environ['CALIBRE_DEVELOP_FROM'])
|
|
||||||
cmd = [sys.executable, '-c', code]
|
|
||||||
print(' '.join(cmd))
|
print(' '.join(cmd))
|
||||||
subprocess.check_call(cmd)
|
subprocess.check_call(cmd)
|
||||||
os.remove(j(base, 'generated.pot'))
|
os.remove(j(base, 'generated.pot'))
|
||||||
|
9
setup/arch-ci.sh
Executable file
9
setup/arch-ci.sh
Executable file
@ -0,0 +1,9 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# arch-ci.sh
|
||||||
|
# Copyright (C) 2020 Kovid Goyal <kovid at kovidgoyal.net>
|
||||||
|
|
||||||
|
set -xe
|
||||||
|
useradd -m ci
|
||||||
|
pacman -S --noconfirm --needed base-devel sudo git sip5 pyqt-builder chmlib icu jxrlib hunspell libmtp libusb libwmf optipng podofo python-apsw python-beautifulsoup4 python-cssselect python-css-parser python-dateutil python-dbus python-dnspython python-dukpy python-feedparser python-html2text python-html5-parser python-lxml python-markdown python-mechanize python-msgpack python-netifaces python-unrardll python-pillow python-psutil python-pygments python-pyqt5 python-regex python-zeroconf python-pyqtwebengine qt5-x11extras qt5-svg qt5-imageformats udisks2 hyphen python-pychm python-pycryptodome speech-dispatcher python-sphinx python-urllib3 python-pip
|
||||||
|
chown -R ci:users $GITHUB_WORKSPACE
|
@ -85,13 +85,6 @@ def download_and_decompress(url, dest, compression=None):
|
|||||||
raise SystemExit('Failed to download ' + url)
|
raise SystemExit('Failed to download ' + url)
|
||||||
|
|
||||||
|
|
||||||
def install_calibre_binary():
|
|
||||||
dest = os.path.expanduser('~/calibre-bin')
|
|
||||||
os.mkdir(dest)
|
|
||||||
download_and_decompress('https://calibre-ebook.com/dist/linux64', dest, 'J')
|
|
||||||
return os.path.join(dest, 'calibre-debug')
|
|
||||||
|
|
||||||
|
|
||||||
def install_qt_source_code():
|
def install_qt_source_code():
|
||||||
dest = os.path.expanduser('~/qt-base')
|
dest = os.path.expanduser('~/qt-base')
|
||||||
os.mkdir(dest)
|
os.mkdir(dest)
|
||||||
@ -111,7 +104,7 @@ def run_python(*args):
|
|||||||
def install_linux_deps():
|
def install_linux_deps():
|
||||||
run('sudo', 'apt-get', 'update', '-y')
|
run('sudo', 'apt-get', 'update', '-y')
|
||||||
# run('sudo', 'apt-get', 'upgrade', '-y')
|
# run('sudo', 'apt-get', 'upgrade', '-y')
|
||||||
run('sudo', 'apt-get', 'install', '-y', 'gettext', 'libgl1-mesa-dev', 'libespeak-ng-dev')
|
run('sudo', 'apt-get', 'install', '-y', 'gettext', 'libgl1-mesa-dev')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
@ -145,12 +138,10 @@ username = api
|
|||||||
'''.replace('PASSWORD', os.environ['tx'])
|
'''.replace('PASSWORD', os.environ['tx'])
|
||||||
with open(os.path.expanduser('~/.transifexrc'), 'w') as f:
|
with open(os.path.expanduser('~/.transifexrc'), 'w') as f:
|
||||||
f.write(transifexrc)
|
f.write(transifexrc)
|
||||||
install_linux_deps()
|
|
||||||
interpreter = install_calibre_binary()
|
|
||||||
install_qt_source_code()
|
install_qt_source_code()
|
||||||
run(interpreter, 'setup.py', 'gui')
|
install_env()
|
||||||
run(interpreter, 'setup.py', 'pot')
|
run(sys.executable, '-m', 'pip', 'install', 'transifex-client')
|
||||||
|
run(sys.executable, 'setup.py', 'pot')
|
||||||
elif action == 'test':
|
elif action == 'test':
|
||||||
os.environ['CI'] = 'true'
|
os.environ['CI'] = 'true'
|
||||||
if ismacos:
|
if ismacos:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user