Skip to content

Commit

Permalink
Allow license_stamper.py to be ran from any directory (#1332)
Browse files Browse the repository at this point in the history
* Allow license_stamper.py to be ran from any directory

* Format

Co-authored-by: kahmed10 <15948690+kahmed10@users.noreply.github.com>
  • Loading branch information
pfultz2 and kahmed10 authored Aug 9, 2022
1 parent b37322a commit 5bf4dee
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions tools/license_stamper.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,14 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
#####################################################################################
import subprocess
import subprocess, os

#Debug flag
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
def getipynb_markdownBlockAsList():
Expand Down Expand Up @@ -222,22 +225,24 @@ def getDelimiter(filename):

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
#bashCommand = "git ls-files --exclude-standard"
#print (bashCommand.split())
proc = subprocess.run("git ls-files --exclude-standard",
shell=True,
stdout=subprocess.PIPE)
stdout=subprocess.PIPE,
cwd=__repo_dir__)
fileList = proc.stdout.decode().split('\n')
message = message.split('\n')

if debug is True:
print("Target file list:\n" + str(fileList))
print("Output Message:\n" + str(message))

for file in fileList:
for rfile in fileList:
file = os.path.join(__repo_dir__, rfile)
#print(file)
commentDelim = getDelimiter(file)
if commentDelim is not None:
Expand Down

0 comments on commit 5bf4dee

Please sign in to comment.