Skip to content

Commit 9cfb17a

Browse files
committed
Merge pull request winpython#25 from stonebig/docs
include Docs directories in build process
2 parents 810bbbe + fdb9747 commit 9cfb17a

File tree

1 file changed

+58
-11
lines changed

1 file changed

+58
-11
lines changed

make.py

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ class WinPythonDistribution(object):
131131

132132
def __init__(self, build_number, release_level, target, instdirs,
133133
srcdirs=None, toolsdirs=None, verbose=False, simulation=False,
134-
rootdir=None, install_options=None, flavor=''):
134+
rootdir=None, install_options=None, flavor='', docsdirs=None):
135135
assert isinstance(build_number, int)
136136
assert isinstance(release_level, str)
137137
self.build_number = build_number
@@ -144,6 +144,9 @@ def __init__(self, build_number, release_level, target, instdirs,
144144
if toolsdirs is None:
145145
toolsdirs = []
146146
self._toolsdirs = toolsdirs
147+
if docsdirs is None:
148+
docsdirs = []
149+
self._docsdirs = docsdirs
147150
self.verbose = verbose
148151
self.winpydir = None
149152
self.python_fname = None
@@ -267,6 +270,14 @@ def toolsdirs(self):
267270
"""Return tools directory list"""
268271
return [osp.join(osp.dirname(osp.abspath(__file__)), 'tools')] + self._toolsdirs
269272

273+
@property
274+
def docsdirs(self):
275+
"""Return docs directory list"""
276+
if osp.isdir(osp.join(osp.dirname(osp.abspath(__file__)), 'docs')):
277+
return [osp.join(osp.dirname(osp.abspath(__file__)), 'docs')] + self._docsdirs
278+
else:
279+
return self._docsdirs
280+
270281
def get_package_fname(self, pattern):
271282
"""Get package matching pattern in instdirs"""
272283
for path in (self.instdirs + self.srcdirs):
@@ -494,6 +505,20 @@ def _copy_dev_tools(self):
494505
print(path + ' --> ' + osp.join(toolsdir, name))
495506
self._print_done()
496507

508+
def _copy_dev_docs(self):
509+
"""Copy dev docs"""
510+
self._print("Copying docs")
511+
docsdir = osp.join(self.winpydir, self.python_name , 'Scripts', 'docs')
512+
os.mkdir(docsdir)
513+
for dirname in self.docsdirs:
514+
for name in os.listdir(dirname):
515+
path = osp.join(dirname, name)
516+
copy = shutil.copytree if osp.isdir(path) else shutil.copyfile
517+
copy(path, osp.join(docsdir, name))
518+
if self.verbose:
519+
print(path + ' --> ' + osp.join(docsdir, name))
520+
self._print_done()
521+
497522
def _create_launchers(self):
498523
"""Create launchers"""
499524
self._print("Creating launchers")
@@ -895,6 +920,7 @@ def make(self, remove_existing=True):
895920
self._install_all_other_packages()
896921
if not self.simulation:
897922
self._copy_dev_tools()
923+
self._copy_dev_docs()
898924
if not self.simulation:
899925
self._create_launchers()
900926
self._create_batch_scripts()
@@ -985,12 +1011,29 @@ def make_winpython(build_number, release_level, architecture,
9851011
for flavor_tools in [toolsdir3, toolsdir4]:
9861012
if osp.isdir(flavor_tools):
9871013
toolsdirs.append(flavor_tools)
1014+
1015+
# create same for docs dirs as for tools dirs
1016+
docsdir1 = osp.join(basedir, 'docs')
1017+
assert osp.isdir(docsdir1)
1018+
docsdirs = [docsdir1]
1019+
docsdir2 = osp.join(basedir, 'docs' + suffix)
1020+
if osp.isdir(docsdir2):
1021+
docsdirs.append(docsdir2)
1022+
# add flavor tools in basedirxx\flavor\tools and tools+suffix
1023+
if flavor != '':
1024+
docsdir3 = osp.join(basedir, flavor, 'docs')
1025+
docsdir4 = osp.join(basedir, flavor, 'docs' + suffix)
1026+
for flavor_docs in [docsdir3, docsdir4]:
1027+
if osp.isdir(flavor_docs):
1028+
docsdirs.append(flavor_docs)
1029+
9881030

9891031
dist = WinPythonDistribution(build_number, release_level,
9901032
builddir, packdirs, srcdirs, toolsdirs,
9911033
verbose=verbose, simulation=simulation,
9921034
rootdir=rootdir,
993-
install_options=install_options, flavor=flavor)
1035+
install_options=install_options,
1036+
flavor=flavor, docsdirs=docsdirs)
9941037
dist.make(remove_existing=remove_existing)
9951038
if create_installer and not simulation:
9961039
dist.create_installer()
@@ -1025,15 +1068,19 @@ def make_all(build_number, release_level, pyver,
10251068
# DO create only what version at a time
10261069
# You may have to manually delete previous build\winpython-.. directory
10271070

1028-
#make_all(1, '', pyver='3.4', rootdir=r'D:\Winpython',
1029-
# verbose=False, archis=(32, ))
1030-
make_all(1, '', pyver='3.4', rootdir=r'D:\Winpython',
1031-
verbose=False, archis=(64, ), flavor='')
1032-
#make_all(2, '', pyver='3.3', rootdir=r'D:\Winpython',
1071+
make_all(2, '', pyver='3.4', rootdir=r'D:\Winpython',
1072+
verbose=False, archis=(32, ))
1073+
#make_all(2, '', pyver='3.4', rootdir=r'D:\Winpython',
1074+
# verbose=False, archis=(64, ), flavor='')
1075+
#make_all(3, '', pyver='3.3', rootdir=r'D:\Winpython',
10331076
# verbose=False, archis=(32, ))
1034-
#make_all(2, '', pyver='3.3', rootdir=r'D:\Winpython',
1077+
#make_all(3, '', pyver='3.3', rootdir=r'D:\Winpython',
10351078
# verbose=False, archis=(64, ))
1036-
# make_all(2, '', pyver='2.7', rootdir=r'D:\Winpython',
1037-
# verbose=False, archis=(32, ))
1038-
#make_all(2, '', pyver='2.7', rootdir=r'D:\Winpython',
1079+
#make_all(3, '', pyver='2.7', rootdir=r'D:\Winpython',
1080+
# verbose=False, archis=(32, ))
1081+
#make_all(3, '', pyver='2.7', rootdir=r'D:\Winpython',
10391082
# verbose=False, archis=(64, ))
1083+
#make_all(2, '', pyver='3.4', rootdir=r'D:\Winpython',
1084+
# verbose=False, archis=(64, ), flavor='FlavorIgraph')
1085+
#make_all(2, '', pyver='3.4', rootdir=r'D:\Winpython',
1086+
# verbose=False, archis=(32, ), flavor='FlavorKivy')

0 commit comments

Comments
 (0)