-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
36 lines (29 loc) · 927 Bytes
/
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
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 26 11:06:13 2017
@author: Soumendra Kumar Sahoo
"""
from distutils.core import setup
from Cython.Build import cythonize
import py_compile
import os
# collect all py and __init__.py files
base_dir = os.getcwd()
init_py = "__init__.py"
py_files = []
pyc_files = ["stock_alert.py"]
for dir, subdir, files in os.walk(base_dir):
rel_path = dir.split(base_dir)
if len(rel_path) > 1:
rel_path = rel_path[1].replace("\\", "/")
else:
rel_path = ""
for filename in files:
if filename == init_py:
pyc_files.append((rel_path + "/" + init_py).lstrip("/"))
elif filename[-3:] == ".py":
if filename == pyc_files[0]:
continue
py_files.append((rel_path + "/" + filename).lstrip("/"))
py_compile.main(pyc_files)
setup(script_args=['build_ext', '--inplace'], ext_modules=cythonize(py_files))