Skip to content

Commit 3179d63

Browse files
committed
Update build.py
1 parent bbe3d39 commit 3179d63

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/build.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env python2.7
22

3-
from os.path import dirname, join, isfile, realpath, relpath, split
3+
from os.path import basename, dirname, join, isfile, realpath, relpath, split
44
from zipfile import ZipFile
55
import sys
66
sys.path.insert(0, 'buildlib/jinja2.egg')
@@ -164,7 +164,17 @@ def select(fn):
164164
for sd in source_dirs:
165165
sd = realpath(sd)
166166
compile_dir(sd)
167-
files += [(x, relpath(realpath(x), sd)) for x in listfiles(sd) if select(x)]
167+
for x in listdir(sd):
168+
if select(x):
169+
# symbolic links should go in the archive by the name of the link, not the name of what they point to
170+
try:
171+
realbase = os.readlink(x)
172+
linkbase = basename(x)
173+
realp = realpath(x).replace(realbase, linkbase)
174+
nufile = (x, relpath(realp, sd))
175+
except OSError:
176+
nufile = (x, relpath(realpath(x), sd))
177+
files.append(nufile)
168178

169179
# create tar.gz of thoses files
170180
tf = tarfile.open(tfn, 'w:gz')

0 commit comments

Comments
 (0)