From 2fa690a5b6d648ff3d4448705a8508119813db26 Mon Sep 17 00:00:00 2001 From: Mateusz Masiarz Date: Sat, 23 Sep 2023 15:11:30 +0200 Subject: [PATCH] Allow running `sinol-make` in subdirectory of package (cherry picked from commit 8151dba09d6074a22902061c5f1b416ed438987c) --- src/sinol_make/util.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/sinol_make/util.py b/src/sinol_make/util.py index 68c2f4f9..6940520d 100644 --- a/src/sinol_make/util.py +++ b/src/sinol_make/util.py @@ -33,11 +33,13 @@ def check_if_package(): """ Function to check if current directory is a package """ - - cwd = os.getcwd() - if os.path.exists(os.path.join(cwd, 'config.yml')): + if os.path.exists(os.path.join(os.getcwd(), 'config.yml')): + return True + elif os.path.exists(os.path.join(os.getcwd(), '..', 'config.yml')): + os.chdir('..') return True - return False + else: + return False def exit_if_not_package():