version up : Perl-5.16.3 including security fixes.
[slapos.git] / component / perl / create-libs-symlink.py
1
2 import fnmatch
3 import os
4 import pprint
5
6
7 def post_make_hook(options, buildout):
8 location = options['location']
9 matches = []
10 for root, dirnames, filenames in os.walk(location):
11 for filename in fnmatch.filter(filenames, 'libperl.a'):
12 matches.append(os.path.join(root, filename))
13 nr_matches = len(matches)
14 if nr_matches == 0:
15 print "ERROR - no libperl.* found!"
16 exit
17 elif nr_matches > 1:
18 print "WARNING - several libperl.a found, taking only the first one:", matches.join("\n")
19
20 # matches[0] is a prefix of "location"
21 # For the symlink, we want the relative path.
22 rel_link = os.path.relpath(os.path.dirname(matches[0]), location)
23 os.symlink(rel_link, os.path.join(location, "libs-c"))
24 print "Created symlink \"libs-c\" to", rel_link