SynBioDex / SBOL-visual

The reference implementation of the SBOL Visual standard
Other
31 stars 15 forks source link

First local run of rebuild_glyphs.py builds all glyphs #139

Closed jakebeal closed 3 years ago

jakebeal commented 3 years ago

When I ran rebuild_glyphs.py locally, it built all glyphs, not just the ones for 2.3, and I'm needing to manually go through and manually delete all of the that shouldn't be kept.

When I rerun after the first run, however, it isn't rebuilding again, so there must be hidden state somewhere.

jamesscottbrown commented 3 years ago

I think that the only hidden state is the modified times of the PDF files, and of the source directories for each glyph.

If the PDF was rebuilt, this should be because the source directory was modified more recently than the PDF. I'm not sure why this would be.

If I checkout a fresh copy of the repo, the PDFs and glyph source directories seem to generally have the same mtime, but this is the time at which they were checked out:

~/Desktop/ $ git clone git@github.com:SynBioDex/SBOL-visual.git

~/Desktop/SBOL-visual/Glyphs/ $ python3
Python 3.6.9 (default, Oct  8 2020, 12:12:24) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> a = os.path.getmtime('origin-of-transfer')
>>> b = os.path.getmtime('origin-of-transfer/origin-of-transfer.pdf')
>>> 
>>> a == b
True
>>>
>>> from datetime import datetime
>>> print(datetime.utcfromtimestamp(a).strftime('%Y-%m-%d %H:%M:%S'))
2020-12-04 11:53:00

So if I do a Git command (e.g., checkout), the mtime of the file is set to the current time rather than the time of the relevant git commit that last changed the file.If this affected an SVG or REAME.md file in a glyph directory (but not the PDF), it could cause the directory to appear to have been modified more recently than the PDF, and result in a rebuild.

git-restore-mtime is a tool that apparently "restores the modification time of files based on the most recent commit that modified them".

Perhaps running this needs to be recommended as a step if manually rebuilding glyphs.