Skip to content

Commit

Permalink
Add misisng scripts
Browse files Browse the repository at this point in the history
Remove circleci
  • Loading branch information
benjello committed Sep 27, 2024
1 parent 8458342 commit 5c73194
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 146 deletions.
93 changes: 0 additions & 93 deletions .circleci/config.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .circleci/has-functional-changes.sh

This file was deleted.

33 changes: 0 additions & 33 deletions .circleci/is-version-number-acceptable.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .circleci/publish-git-tag.sh

This file was deleted.

4 changes: 0 additions & 4 deletions .circleci/publish-python-package.sh

This file was deleted.

Empty file.
55 changes: 55 additions & 0 deletions openfisca_tunisia/scripts/check_path_length.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
'''
EN: Look into folders to check path length and return an error if a too long path is found.
Also write too long path in a file.
FR: Ce script sert à estimer la longueur des chemins d'arborescence des paramètres,
afin de ne pas avoir de chemins > 150 caractères (incompatible Windows).
Il est à utiliser avant de contribuer à l'harmonisation
'''


import os
import logging


logging.basicConfig(level=logging.INFO)


def extract_paths_too_long(root_dir):
'''
Look into folders to check path length and return True if a too long path is found.
'''
path_too_long_detected = False
maxlen = 0
root_dir = root_dir.rstrip(os.sep)

with open('path_too_long_list.txt', 'w') as outfile:
for path, dirs, files in os.walk(root_dir):
relative_path = path[len(root_dir) + 1:]
for dir in dirs:
if dir.startswith('.'):
# Ignore hidden directories.
dirs.remove(dir)
for file in files:
if file.startswith('.'):
# Ignore hidden files.
continue
relative_file_path = os.path.join(relative_path, file)
maxlen = max(maxlen, len(relative_file_path))
if len(relative_file_path) > 150:
path_too_long_detected = True
logging.error(f'Path too long of {len(relative_file_path)-150} characters : {relative_file_path}')
outfile.write('{} here: {}\n'.format(
len(relative_file_path),
relative_file_path,
))
logging.info(f'Max length found : {maxlen} characters.')
return path_too_long_detected


country_dir = os.path.dirname((os.path.dirname(os.path.abspath(__file__))))
parameters_dir = os.path.join(country_dir, 'parameters')
if extract_paths_too_long(parameters_dir):
# Return code 1 to indicate an error. Default is 0.
exit(1)
# If no path are too long, the default return is 0: no error.

0 comments on commit 5c73194

Please sign in to comment.