Skip to content

Instantly share code, notes, and snippets.

@codeslord
Created June 11, 2019 07:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeslord/93cba4fb38cea581b2b84fe044f73165 to your computer and use it in GitHub Desktop.
Save codeslord/93cba4fb38cea581b2b84fe044f73165 to your computer and use it in GitHub Desktop.
# Copying folders
self.output_dir = output_dir
if output_dir is not None:
if not os.path.isdir(output_dir):
os.makedirs(output_dir)
html_index_path = pkg_resources.resource_filename("droidbot", "resources/index.html")
stylesheets_path = pkg_resources.resource_filename("droidbot", "resources/stylesheets")
images_path = pkg_resources.resource_filename("droidbot", "resources/images")
target_stylesheets_dir = os.path.join(output_dir, "stylesheets")
target_images_dir = os.path.join(output_dir, "images")
if os.path.exists(target_stylesheets_dir):
shutil.rmtree(target_stylesheets_dir)
if os.path.exists(target_images_dir):
shutil.rmtree(target_images_dir)
shutil.copy(html_index_path, output_dir)
shutil.copytree(stylesheets_path, target_stylesheets_dir)
shutil.copytree(images_path, target_images_dir)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment