Support building in container

This commit is contained in:
Kovid Goyal 2024-08-13 21:37:50 +05:30
parent 67bb8299c6
commit 149d680e60
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 5 additions and 2 deletions

View File

@ -276,9 +276,9 @@ def create_tarfile(env, compression_level='9'):
try: try:
shutil.rmtree(base) shutil.rmtree(base)
except EnvironmentError as err: except EnvironmentError as err:
if err.errno != errno.ENOENT: if err.errno not in (errno.ENOENT, errno.EBUSY):
raise raise
os.mkdir(base) os.makedirs(base, exist_ok=True) # when base is a mount point deleting it fails with EBUSY
dist = os.path.join(base, '%s-%s-%s.tar' % (calibre_constants['appname'], calibre_constants['version'], arch)) dist = os.path.join(base, '%s-%s-%s.tar' % (calibre_constants['appname'], calibre_constants['version'], arch))
with tarfile.open(dist, mode='w', format=tarfile.PAX_FORMAT) as tf: with tarfile.open(dist, mode='w', format=tarfile.PAX_FORMAT) as tf:
cwd = os.getcwd() cwd = os.getcwd()

View File

@ -316,6 +316,9 @@ class BuildTest(unittest.TestCase):
raise unittest.SkipTest('Skipping Qt build test as sanitizer is enabled') raise unittest.SkipTest('Skipping Qt build test as sanitizer is enabled')
from qt.core import QApplication, QFontDatabase, QImageReader, QLoggingCategory, QNetworkAccessManager, QSslSocket, QTimer from qt.core import QApplication, QFontDatabase, QImageReader, QLoggingCategory, QNetworkAccessManager, QSslSocket, QTimer
QLoggingCategory.setFilterRules('''qt.webenginecontext.debug=true''') QLoggingCategory.setFilterRules('''qt.webenginecontext.debug=true''')
if hasattr(os, 'geteuid') and os.geteuid() == 0:
# likely a container build, webengine cannot run as root with sandbox
os.environ['QTWEBENGINE_CHROMIUM_FLAGS'] = '--no-sandbox'
from qt.webengine import QWebEnginePage from qt.webengine import QWebEnginePage
from calibre.utils.img import image_from_data, image_to_data, test from calibre.utils.img import image_from_data, image_to_data, test