[MacSDK] Fix typo in ironlangs manifest
[mono.git] / packaging / MacSDK / ironlangs.py
1 import os
2 import string
3
4
5 class IronLanguagesPackage(GitHubTarballPackage):
6
7     def __init__(self):
8         GitHubTarballPackage.__init__(self,
9                                       'IronLanguages', 'iron-languages',
10                                       '2.11',
11                                       'de63773744ccf9873c1826470730ae0446fd64d7',
12                                       configure='')
13
14         # override: avoid naming the package 'main' because of the repo name
15         self.sources = [
16             'https://github.com/%{organization}/main/tarball/%{revision}']
17         self.source_dir_name = '%s-%s-%s' % (
18             self.organization, 'main', self.revision[:7])
19
20     def build(self):
21         self.ironruby = os.path.join(
22             self.workspace, 'ironruby', 'bin') + os.sep
23         self.ironpython = os.path.join(
24             self.workspace, 'ironpython', 'bin') + os.sep
25         self.sh(
26             'msbuild /p:Configuration=Release /p:OutDir="%{ironruby}" Solutions/Ruby.sln')
27         self.sh(
28             'msbuild /p:Configuration=Release /p:OutDir="%{ironpython}" Solutions/IronPython.Mono.sln')
29
30     def install_ruby_scripts(self, path, installdir):
31         for cmd, ext in map(os.path.splitext, os.listdir(path)):
32             if ext != '.exe':
33                 continue
34             wrapper = os.path.join(self.staged_prefix, "bin", cmd)
35             with open(wrapper, "w") as output:
36                 output.write("#!/bin/sh\n")
37                 output.write(
38                     "exec {0}/bin/mono {0}/lib/{1}/{2}.exe \"$@\"\n".format(
39                         self.staged_prefix, installdir, cmd))
40             os.chmod(wrapper, 0o755)
41
42     def install_python_scripts(self, path, installdir):
43         for cmd, ext in map(os.path.splitext, os.listdir(path)):
44             if ext != '.exe':
45                 continue
46             wrapper = os.path.join(self.staged_prefix, "bin", cmd)
47             with open(wrapper, "w") as output:
48                 output.write("#!/bin/sh\n")
49                 output.write(
50                     'export IRONPYTHONPATH=/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/\n')
51                 output.write(
52                     "exec {0}/bin/mono {0}/lib/{1}/{2}.exe \"$@\"\n".format(
53                         self.staged_prefix, installdir, cmd))
54             os.chmod(wrapper, 0o755)
55
56     def install(self):
57         self.sh("mkdir -p %{staged_prefix}/lib/ironruby/")
58         self.sh("mkdir -p %{staged_prefix}/bin/")
59         self.sh("cp -R %{ironruby} %{staged_prefix}/lib/ironruby/")
60         self.install_ruby_scripts(self.ironruby, 'ironruby')
61
62         self.sh("mkdir -p %{staged_prefix}/lib/ironpython/")
63         self.sh("cp -R %{ironpython} %{staged_prefix}/lib/ironpython/")
64         self.install_python_scripts(self.ironpython, 'ironpython')
65
66 IronLanguagesPackage()