HEPData / hepdata_lib

Library for getting your data into HEPData
https://hepdata-lib.readthedocs.io
MIT License
15 stars 39 forks source link

Additional resources not copied to .tar.gz when added through Table #173

Closed butsuri43 closed 3 years ago

butsuri43 commented 3 years ago

Hey,

when adding additional resources through Table rather than Submission object the additional resources are not being added to the submission tarball created.

The behaviour can be reproduced with the following code:

import hepdata_lib
sub=hepdata_lib.Submission()
tab=hepdata_lib.Table('test')
tab.add_additional_resource("replica1","example/ph1_pt_replicas.tar.gz",True)
sub.add_table(tab)
sub.create_files()

the resulting tarball is missing ph1_pt_replicas.tar.gz, however untared directory with submission files contains the required object fine.

The bug can be traced to https://github.com/HEPData/hepdata_lib/blob/master/hepdata_lib/__init__.py#L562-L563 where only files in Submission object's 'files_to_copy' are copied to the tarball. 'files_to_copy' inside tables are not looped over.

AndreasAlbert commented 3 years ago

Hi @butsuri43, thanks for reporting this with a nice example. I can reproduce the problem on my end and will push a fix in a little bit.

AndreasAlbert commented 3 years ago

The fix is now available in #174. That PR will only be merged after being reviewed by another maintainer. Until then, feel free to just pull the branch and give it a try. Let me know if that should not fix your problem.

butsuri43 commented 3 years ago

Many thanks for very quick fix!

Indeed the problem seem to be solved in the version provided!

While testing I have find another issue, however as unrelated to the original bug I created a new ticket (https://github.com/HEPData/hepdata_lib/issues/175).