Skip to content

Commit 70b5f0f

Browse files
committed
[STAGE] Can't work on windows, awk and all UNIX-like commands doesn't exists. Need to find a FULL python alternative
1 parent 81ae00a commit 70b5f0f

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@ ENV/
9999

100100
# mypy
101101
.mypy_cache/
102+
.idea/

42PyChecker.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import os
2+
import sys
3+
import subprocess
4+
5+
def check_author_file(project_path: str):
6+
# @todo: Add a skip if author file set as optional
7+
author_fr = project_path + "/auteur"
8+
author_us = project_path + "/author"
9+
if os.path.exists(author_fr):
10+
output = subprocess.check_output("awk 'END {printf NR}' " + author_fr, shell=True)
11+
elif os.path.exists(author_us):
12+
output = subprocess.check_output("awk 'END {printf NR}' " + author_us, shell=True)
13+
else:
14+
print("Author file not found")
15+
sys.exit() # @todo Add message if author file is set as optional
16+
if output != 1:
17+
print("Too many lines in author file (Or the file is empty)")
18+
sys.exit() # @todo Add message if author file is set as optional or if project isn't solo
19+
20+
check_author_file("C:/Users/Jules/PycharmProjects/42PyChecker")

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@
186186
same "printed page" as the copyright notice for easier
187187
identification within third-party archives.
188188

189-
Copyright [yyyy] [name of copyright owner]
189+
Copyright 2018-present Jules Lasne
190190

191191
Licensed under the Apache License, Version 2.0 (the "License");
192192
you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)