-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pyperl-1.0.1d-improved-setup.py
62 lines (56 loc) · 2.14 KB
/
pyperl-1.0.1d-improved-setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
--- pyperl-1.0.1d/setup.py.norebuild 2007-10-16 11:42:41.000000000 +0200
+++ pyperl-1.0.1d/setup.py 2007-10-20 07:37:16.000000000 +0200
@@ -2,6 +2,7 @@
from distutils.core import setup, Extension
from distutils.command.install import install
+from distutils.command.build import build
DEBUG = 0
perl = 'perl'
@@ -142,6 +143,23 @@ ext_modules.append(Extension(name = ext_
))
ext_modules.extend(extra_ext)
+class build_perl(build):
+ def run(self):
+ os.chdir('Python-Object')
+ build.spawn(self, ['perl','Makefile.PL', 'INSTALLDIRS=vendor'], 'Python-Object')
+ build.spawn(self, ['make'])
+ os.chdir('..')
+ build.run(self)
+
+class test(build):
+ def run(self):
+ cwd=os.getcwd()
+ ldpath = '%s/Python-Object/blib/arch/auto/Python/Object' % cwd
+ perllib = '%s/Python-Object/blib/lib' % cwd
+ pypath = '%s/%s' % (cwd, self.build_lib)
+ os.system('LD_LIBRARY_PATH="%s" PERL5LIB="%s" PYTHONPATH="%s" python test.py' % (ldpath, perllib, pypath))
+ build.run(self)
+
class my_install(install):
def run(self):
@@ -150,17 +168,15 @@ class my_install(install):
if os.access(multi_perl, os.F_OK):
os.unlink(multi_perl)
- os.chdir(os.path.join(cur_dir, 'Python-Object'))
- retcode = subprocess.call(['perl', 'Makefile.PL'])
- retcode = subprocess.call(["make", "install"])
- os.chdir(cur_dir)
+ os.chdir('Python-Object')
+ install.spawn(self, ["make", "DESTDIR=%s" % self.root, "install"])
+ os.chdir('..')
if "-DMULTI_PERL" in cc_extra:
cc_extra.pop(cc_extra.index("-DMULTI_PERL"))
sources.pop(sources.index('thrd_ctx.c'))
# Run actual install
install.run(self)
-
setup (name = "pyperl",
version = "1.0.1",
description = "Embed a Perl interpreter",
@@ -169,5 +185,5 @@ setup (name = "pyperl",
author_email= "gisle@ActiveState.com",
py_modules = ['dbi', 'dbi2', 'perlpickle', 'perlmod'],
ext_modules = ext_modules,
- cmdclass = { 'install': my_install }
+ cmdclass = { 'install': my_install, 'build': build_perl, 'test': test }
)