forked from jonathf/matlab2cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·60 lines (46 loc) · 1.44 KB
/
setup.py
File metadata and controls
executable file
·60 lines (46 loc) · 1.44 KB
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
#!/usr/bin/env python
# encoding: utf8
import platform
import os
import sys
system = platform.system()
from distutils.core import setup
setup(
name='matlab2cpp',
version='0.5',
packages=['matlab2cpp', 'matlab2cpp/node', 'matlab2cpp/tree',
'matlab2cpp/rules', 'matlab2cpp/testsuite', 'matlab2cpp/supplement',
'matlab2cpp/manual', 'matlab2cpp/configure'],
# package_dir={'': ''},
url='https://github.com/jonathf/matlab2cpp',
license='BSD',
author="Jonathan Feinberg",
author_email="jonathan@feinberg.no",
description='Matlab to C++ converter'
)
"""OPTIONAL the code below will copy the executable m2cpp to a folder which is in path."""
#Windows
if system == "Windows":
system_path = sys.executable
cwdir = os.getcwd()
new_file = open('m2cpp.bat', 'w')
command_run = '@echo off\n' + system_path + ' ' + cwdir + os.sep + 'm2cpp.py' + ' %*'
new_file.write(command_run)
new_file.close()
#copy m2cpp.bat to sys.executable
bat_dst = sys.executable
bat_dst = os.path.dirname(bat_dst)
from shutil import copy
copy("m2cpp.bat", bat_dst)
print
print "Program now runnable through 'm2cpp'"
print "> m2cpp -h"
else: #Linux/Mac
m2cpp = "cp -v m2cpp.py /usr/local/bin/m2cpp"
os.system(m2cpp)
chmod = "chmod 755 /usr/local/bin/m2cpp"
print chmod
os.system(chmod)
print
print "Program now runnable through 'm2cpp'"
print "> m2cpp -h"