-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
51 lines (44 loc) · 1.16 KB
/
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
from setuptools import setup, find_packages, Command
import distutils.command.build
import subprocess
import os
class build_pre(Command):
def initialize_options(self):
pass
def finalize_options(self):
pass
def run(self):
dir_path = os.path.dirname(os.path.realpath(__file__))
src_path = os.path.join(dir_path, 'src')
out_path = os.path.join(src_path, 'loadcaffe/__internal')
proto_path = os.path.join(src_path, 'caffe.proto')
cmd = ['protoc',
'--python_out', out_path,
'-I', src_path,
proto_path]
subprocess.call(cmd)
class build(distutils.command.build.build):
sub_commands = [
('build_pre', lambda self: True),
] + distutils.command.build.build.sub_commands
setup(
name='loadcaffe',
description='A library to convert caffe model to PyTorch model',
version='0.1',
author='Stephen Zhang',
author_email='[email protected]',
license='MIT',
url='https://github.com/zsrkmyn/pytorch_loadcaffe',
packages=find_packages('src'),
install_requires = [
'protobuf',
'torch',
],
cmdclass = {
'build': build,
'build_pre': build_pre,
},
package_dir = {
'': 'src'
},
)