| 46 | |
| 47 | |
| 48 | class CargoExtension(Extension): |
| 49 | def __init__(self, |
| 50 | target, |
| 51 | src, |
| 52 | dst, |
| 53 | features=[]): |
| 54 | Extension.__init__(self, target, sources=[]) |
| 55 | self.target = target |
| 56 | self.src = src |
| 57 | self.dst = dst |
| 58 | self.features = features |
| 59 | |
| 60 | def build(self): |
| 61 | command = ['cargo', 'build', '-p', self.target] |
| 62 | if len(self.features) != 0: |
| 63 | command.append('--features') |
| 64 | command.append(' '.join(self.features)) |
| 65 | if not debug: |
| 66 | command.append('--release') |
| 67 | sp.check_call(command) |
| 68 | |
| 69 | def install(self, prefix): |
| 70 | copy_file('{}/{}'.format(prefix, self.src), 'megflow/{}'.format(self.dst)) |
| 71 | |
| 72 | |
| 73 | class CopyExtension(Extension): |