Skip to content
Snippets Groups Projects
Commit ffef39ae authored by Ekaterina Evdokimova's avatar Ekaterina Evdokimova
Browse files

Merge branch 'license-update' into 'master'

update licenses to gig.tech; support removing old license

See merge request !4
parents 4fea30fa 9c7e1a58
1 merge request!4update licenses to gig.tech; support removing old license
......@@ -16,6 +16,9 @@
import sys
import os
import time
import re
license_pattern = r'(# -.*@@license_version:.*@@\n)'
def main(path):
......@@ -32,7 +35,6 @@ def main(path):
files.append(os.path.join(path, file))
with open(license_path, "r") as f:
license = f.read()
license = license.replace('20[0-9][0-9]', time.strftime('%Y'))
for file_ in files:
print("[*] Checking file {}".format(file_))
......@@ -41,10 +43,17 @@ def main(path):
if license[2:] in file_content:
print(" [+] Skip file, cause license is already there")
continue
old_licence = re.search(license_pattern, file_content, re.DOTALL)
if old_licence:
print(" [+] Updating license in file {}".format(file_))
file_content = file_content.replace(old_licence.group(), license)
else:
print(" [+] Adding license to file {}".format(file_))
file_content = license + file_content
print(" [+] Adding license to file {}".format(file_))
f.truncate(0)
f.seek(0)
f.write(license + file_content)
f.write(file_content)
if __name__ == "__main__":
......
# -*- coding: utf-8 -*-
# COPYRIGHT (C) 2018-20[0-9][0-9] GIG TECHNOLOGY NV
# COPYRIGHT (C) 2018-2021 GIG.TECH NV
# ALL RIGHTS RESERVED.
#
# ALTHOUGH YOU MAY BE ABLE TO READ THE CONTENT OF THIS FILE, THIS FILE
# CONTAINS CONFIDENTIAL INFORMATION OF GIG TECHNOLOGY NV. YOU ARE NOT ALLOWED
# CONTAINS CONFIDENTIAL INFORMATION OF GIG.TECH NV. YOU ARE NOT ALLOWED
# TO MODIFY, REPRODUCE, DISCLOSE, PUBLISH OR DISTRIBUTE ITS CONTENT,
# EMBED IT IN OTHER SOFTWARE, OR CREATE DERIVATIVE WORKS, UNLESS PRIOR
# WRITTEN PERMISSION IS OBTAINED FROM GIG TECHNOLOGY NV.
# WRITTEN PERMISSION IS OBTAINED FROM GIG.TECH NV.
#
# THE COPYRIGHT NOTICE ABOVE DOES NOT EVIDENCE ANY ACTUAL OR INTENDED
# PUBLICATION OF SUCH SOURCE CODE.
#
# @@license_version:1.8@@
# @@license_version:1.9@@
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment