Skip to content

Commit f8deedd

Browse files
committed
Use a static tmp dir for user manual builds
1 parent 07274c3 commit f8deedd

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

‎setup/__init__.py‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,3 +296,9 @@ def installer_names(include_source=True):
296296
yield f'{base}-{__version__}-{arch}.txz'
297297
if include_source:
298298
yield f'{base}-{__version__}.tar.xz'
299+
300+
301+
@lru_cache
302+
def manual_build_dir():
303+
# cant use tempfile.gettempdir() as calibre.startup overrides it
304+
return os.path.join('/tmp', 'user-manual-build')

‎setup/publish.py‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@
1111
import shutil
1212
import subprocess
1313
import sys
14-
import tempfile
1514
import time
1615

17-
from setup import Command, __version__, installer_names, require_clean_git, require_git_master
16+
from setup import Command, __version__, installer_names, manual_build_dir, require_clean_git, require_git_master
1817
from setup.parallel_build import create_job, parallel_build
1918

2019

@@ -180,7 +179,7 @@ def add_options(self, parser):
180179
)
181180

182181
def run(self, opts):
183-
tdir = self.j(tempfile.gettempdir(), 'user-manual-build')
182+
tdir = manual_build_dir()
184183
if os.path.exists(tdir):
185184
shutil.rmtree(tdir)
186185
os.mkdir(tdir)

‎setup/upload.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import sys
1616
import time
1717
from subprocess import check_call
18-
from tempfile import NamedTemporaryFile, gettempdir, mkdtemp
18+
from tempfile import NamedTemporaryFile, mkdtemp
1919
from zipfile import ZipFile
2020

2121
from polyglot.builtins import iteritems
@@ -25,7 +25,7 @@
2525
d = os.path.dirname
2626
sys.path.insert(0, d(d(os.path.abspath(__file__))))
2727

28-
from setup import Command, __appname__, __version__, installer_names
28+
from setup import Command, __appname__, __version__, installer_names, manual_build_dir
2929

3030
DOWNLOADS = '/srv/main/downloads'
3131
HTML2LRF = 'calibre/ebooks/lrf/html/demo'
@@ -343,7 +343,7 @@ def run(self, opts):
343343
for x in glob.glob(self.j(path, '*')):
344344
self.build_plugin_example(x)
345345

346-
srcdir = self.j(gettempdir(), 'user-manual-build', 'en', 'html') + '/'
346+
srcdir = self.j(manual_build_dir(), 'en', 'html') + '/'
347347
check_call(
348348
' '.join(
349349
['rsync', '-zz', '-rl', '--info=progress2', srcdir, 'main:/srv/manual/']

0 commit comments

Comments
 (0)