"git@developer.sourcefind.cn:gaoqiong/migraphx.git" did not exist on "cf11f657f0cb7a10c00cdb2558a2a29ac581469a"
Unverified Commit 5bf4dee6 authored by Paul Fultz II's avatar Paul Fultz II Committed by GitHub
Browse files

Allow license_stamper.py to be ran from any directory (#1332)



* Allow license_stamper.py to be ran from any directory

* Format
Co-authored-by: default avatarkahmed10 <15948690+kahmed10@users.noreply.github.com>
parent b37322ae
...@@ -22,11 +22,14 @@ ...@@ -22,11 +22,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE. # THE SOFTWARE.
##################################################################################### #####################################################################################
import subprocess import subprocess, os
#Debug flag #Debug flag
debug = False debug = False
__repo_dir__ = os.path.normpath(
os.path.join(os.path.realpath(__file__), '..', '..'))
# Markdown code blob we should use to insert into notebook files # Markdown code blob we should use to insert into notebook files
def getipynb_markdownBlockAsList(): def getipynb_markdownBlockAsList():
...@@ -222,14 +225,15 @@ def getDelimiter(filename): ...@@ -222,14 +225,15 @@ def getDelimiter(filename):
def main(): def main():
message = open('LICENSE').read() message = open(os.path.join(__repo_dir__, 'LICENSE')).read()
#Get a list of all the files in our git repo #Get a list of all the files in our git repo
#bashCommand = "git ls-files --exclude-standard" #bashCommand = "git ls-files --exclude-standard"
#print (bashCommand.split()) #print (bashCommand.split())
proc = subprocess.run("git ls-files --exclude-standard", proc = subprocess.run("git ls-files --exclude-standard",
shell=True, shell=True,
stdout=subprocess.PIPE) stdout=subprocess.PIPE,
cwd=__repo_dir__)
fileList = proc.stdout.decode().split('\n') fileList = proc.stdout.decode().split('\n')
message = message.split('\n') message = message.split('\n')
...@@ -237,7 +241,8 @@ def main(): ...@@ -237,7 +241,8 @@ def main():
print("Target file list:\n" + str(fileList)) print("Target file list:\n" + str(fileList))
print("Output Message:\n" + str(message)) print("Output Message:\n" + str(message))
for file in fileList: for rfile in fileList:
file = os.path.join(__repo_dir__, rfile)
#print(file) #print(file)
commentDelim = getDelimiter(file) commentDelim = getDelimiter(file)
if commentDelim is not None: if commentDelim is not None:
......
Markdown is supported
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