I have the following code:
with ZipFile('deploy.zip', 'w') as deploy:
if os.path.isfile(artifact.source):
deploy.write(artifact.source, artifact.target)
else:
for base, dirs, files in os.walk(artifact.source):
for file_ in files:
source = os.path.join(base, file_)
target = os.path.join(base[base.index(artifact.target):], file_)
deploy.write(source, target)
when this code finish, only the files that match when the artifact.source
is a file are added to the deploy.zip. And in some cases artifact.source
will be a directory (i have tested this case too) ad the for
part will be executed.
The result of the following lines are valid and source exists for every iteration:
source = os.path.join(base, file_)
target = os.path.join(base[base.index(artifact.target):], file_)
Here the full code that i'm working: https://gist.github.com/khaoz/9b04d87b0900fba780f0 Set config.project_root to something like "c:\temp" and remove the import config line. OBS: I'm a Python newbie, so ignore some crap code that you will see :P
And here a example of my csv file: https://gist.github.com/khaoz/e9a59390f415f22d46db
What i'm doing wrong ?