Skip to content

Commit 001fd94

Browse files
committed
deepzoom-tile: Copy OpenSeadragon into output dir if -r specified
1 parent 98bcc26 commit 001fd94

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

examples/deepzoom/deepzoom-tile.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from optparse import OptionParser
2727
import os
2828
import re
29+
import shutil
2930
import sys
3031
from unicodedata import normalize
3132

@@ -125,6 +126,7 @@ def run(self):
125126
if self._with_viewer:
126127
for name in self._slide.associated_images:
127128
self._run_image(name)
129+
self._write_static()
128130
self._shutdown()
129131

130132
def _run_image(self, associated=None):
@@ -142,6 +144,22 @@ def _run_image(self, associated=None):
142144
DeepZoomImageTiler(dz, basename, self._format, associated,
143145
self._queue).run()
144146

147+
def _write_static(self):
148+
basesrc = os.path.join(os.path.dirname(os.path.abspath(__file__)),
149+
'static')
150+
basedst = os.path.join(self._basename, 'static')
151+
self._copydir(basesrc, basedst)
152+
self._copydir(os.path.join(basesrc, 'images'),
153+
os.path.join(basedst, 'images'))
154+
155+
def _copydir(self, src, dest):
156+
if not os.path.exists(dest):
157+
os.makedirs(dest)
158+
for name in os.listdir(src):
159+
srcpath = os.path.join(src, name)
160+
if os.path.isfile(srcpath):
161+
shutil.copy(srcpath, os.path.join(dest, name))
162+
145163
_punct_re = re.compile(r'[\t !"#$%&\'()*\-/<=>?@\[\\\]^_`{|},.]+')
146164
@classmethod
147165
def _slugify(cls, text):

0 commit comments

Comments
 (0)