Created
January 13, 2017 03:01
-
-
Save deckerego/a0f30d2deab4efff4d18a2c03b84fefc to your computer and use it in GitHub Desktop.
Create a map of tuples for recursively adding files into setup.py's data_files setting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
def all_files(newroot, oldroot): | |
fdtuples = [] | |
for root, dirs, files in os.walk(oldroot): | |
fds = [] | |
for fd in files: | |
if not fd[0] is '.': | |
fds.append(os.path.join(root, fd)) | |
relpath = os.path.relpath(root, oldroot) | |
fdtuple = (os.path.join(newroot, relpath), fds) | |
fdtuples.append(fdtuple) | |
return fdtuples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment