forked from sjev/trading-with-python
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcreateDistribution.py
More file actions
44 lines (29 loc) · 1.15 KB
/
createDistribution.py
File metadata and controls
44 lines (29 loc) · 1.15 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
# -*- coding: utf-8 -*-
import os, shutil
def copyFiles(sourceDir,targetDir,includes=None):
print('Copy %s -> %s' % (sourceDir,targetDir))
if not os.path.exists(targetDir):
print('Creating ',targetDir)
os.makedirs(targetDir)
for f in os.listdir(sourceDir):
base,ext = os.path.splitext(f)
if (ext =='.py') and (True if not includes else (base in includes)):
s = os.path.join(sourceDir, f)
d = os.path.join(targetDir, f)
print(s, '->', d)
shutil.copyfile(s,d)
sourceDir = 'lib'
targetDir = 'dist/tradingWithPython/lib'
includes = ['__init__','cboe','csvDatabase','functions','yahooFinance','extra','bats','backtest','plotting']
DEST = 'dist/tradingWithPython'
try:
shutil.rmtree(DEST)
except:
pass
os.makedirs(DEST) # create target dir
print('-----------init file---------')
shutil.copyfile('__init__.py',os.path.join(DEST,'__init__.py'))
print('-----------lib files---------')
copyFiles(sourceDir,targetDir,includes)
print('-----------IB files----------')
copyFiles(sourceDir+'/interactiveBrokers',targetDir+'/interactiveBrokers')