def genexamples(_): import zipfile from sporco.util import netgetdata url = 'https://codeload.github.com/bwohlberg/sporco-notebooks/zip/master' print('Constructing docs from example scripts') if on_rtd: epth = '../../examples' else: epth = os.path.join(rootpath, 'examples') spth = os.path.join(epth, 'scripts') npth = os.path.join(epth, 'notebooks') if on_rtd: rpth = 'examples' else: rpth = os.path.join(confpath, 'examples') if not os.path.exists(npth): print('Notebooks required for examples section not found: ' 'downloading from sporco-notebooks repo on GitHub') zipdat = netgetdata(url) zipobj = zipfile.ZipFile(zipdat) zipobj.extractall(path=epth) os.rename(os.path.join(epth, 'sporco-notebooks-master'), os.path.join(epth, 'notebooks')) docntbk.make_example_scripts_docs(spth, npth, rpth)