Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
sagemathinc
GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/update_version
Views: 237
#!/usr/bin/env python

'''
This updates the version file, which bakes this data into the webapp.

To force an update for users (showing them an information box that they have to update)
wait until deployed and set the "version" in the database.

Goto account -> admin site settings -> required browser version
'''

import argparse, os, time

ROOT = os.path.dirname(os.path.realpath(__file__))
TARGET = os.path.join(ROOT, "packages/util/smc-version.js")

def write_version_file():
    # Create version file, based on the current time
    now = int(time.time())
    v = []
    v.append("/* autogenerated by the update_version script */")
    v.append("exports.version=%s;"%now)
    open(TARGET,'w').write('\n'.join(v) + '\n')
    os.chdir(os.path.join(ROOT, "packages/util"))
    os.system("npm run build")

if __name__ == "__main__":
    parser = argparse.ArgumentParser(description='Update CoCalc frontend version number')
    args = parser.parse_args()
    write_version_file()