Commit 3599de61 authored by Julien Muchembled's avatar Julien Muchembled

perl: make post-make-hook script compatible with Python 3

parent 17931bed
......@@ -25,4 +25,4 @@ configure-command =
-Dusethreads
environment =
PATH=${patch:location}/bin:%(PATH)s
post-make-hook = ${:_profile_base_location_}/perl-create-libs-symlink.py#28d12de5c9c7985e65233d56817e3bec:post_make_hook
post-make-hook = ${:_profile_base_location_}/perl-create-libs-symlink.py#943453b7d3ff8d49ed12d44a7f7076ee:post_make_hook
from zc.buildout import UserError
import fnmatch
import os
import pprint
def post_make_hook(options, buildout):
location = options['location']
matches = []
for root, dirnames, filenames in os.walk(location):
for filename in fnmatch.filter(filenames, 'libperl.a'):
matches.append(os.path.join(root, filename))
nr_matches = len(matches)
if nr_matches == 0:
print "ERROR - no libperl.* found!"
exit
elif nr_matches > 1:
print "WARNING - several libperl.a found, taking only the first one:", "\n".join(matches)
matches = [os.path.join(root, filename)
for root, dirnames, filenames in os.walk(location)
for filename in fnmatch.filter(filenames, 'libperl.a')]
if not matches:
raise UserError("ERROR - no libperl.* found!")
if len(matches) > 1:
print("WARNING - several libperl.a found, taking only the first one:",
"\n".join(matches))
# matches[0] is a prefix of "location"
# For the symlink, we want the relative path.
rel_link = os.path.relpath(os.path.dirname(matches[0]), location)
......@@ -24,4 +20,4 @@ def post_make_hook(options, buildout):
if os.path.islink(simlink_location):
os.unlink(simlink_location)
os.symlink(rel_link, simlink_location)
print "Created symlink \"libs-c\" to", rel_link
print("Created symlink \"libs-c\" to", rel_link)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment