Skip to content

Commit e92d872

Browse files
committed
make file referencing more robust
1 parent 49bfb07 commit e92d872

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

scripts/add_new_contribution_to_yaml.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
from datetime import datetime
55
import json
6+
import pathlib
67
from sys import argv
78

89
from ruamel.yaml import YAML
@@ -25,7 +26,7 @@
2526
props['download'] = props['source'][:props['source'].rfind('.')] + '.zip'
2627

2728
# open database
28-
database_file = '../contributions.yaml'
29+
database_file = pathlib.Path(__file__).parent.parent / 'contributions.yaml'
2930

3031
yaml = YAML()
3132
with open(database_file, 'r') as db:

scripts/fetch_updates.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"""
44
import argparse
55
from datetime import datetime
6+
import pathlib
67
from ruamel.yaml import YAML
78

89
from parse_and_validate_properties_txt import read_properties_txt, parse_text, validate_existing
@@ -81,7 +82,7 @@ def process_contribution(contribution):
8182
if args.index:
8283
index = args.index
8384

84-
database_file = '../contributions.yaml'
85+
database_file = pathlib.Path(__file__).parent.parent / 'contributions.yaml'
8586

8687
# read in database yaml file
8788
yaml = YAML()

scripts/utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
import pathlib
12
from ruamel.yaml import YAML
23

3-
database_file = '../contributions.yaml'
4+
database_file = pathlib.Path(__file__).parent.parent / 'contributions.yaml'
45

56

67
def get_contributions():

0 commit comments

Comments
 (0)