1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-11-14 08:16:15 +01:00

Fix path construction involving Path.cwd()

pathlib uses the '/' operator to combine paths rather than '+'
This commit is contained in:
Dirk Müller 2022-10-30 19:52:06 +01:00
parent 774f8406a8
commit 1eb5451732
No known key found for this signature in database

View File

@ -6478,8 +6478,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
opts.alternative_project = None opts.alternative_project = None
except oscerr.NoWorkingCopy: except oscerr.NoWorkingCopy:
# This may be a project managed entirely via git? # This may be a project managed entirely via git?
if os.path.isdir(Path.cwd() + "/../.osc") and os.path.isdir(Path.cwd() + "/../.git"): if os.path.isdir(Path.cwd().parent / '.osc') and os.path.isdir(Path.cwd().parent / '.git'):
project = store_read_project(Path.cwd() + "/..") project = store_read_project(Path.cwd())
opts.alternative_project = project opts.alternative_project = project
pass pass
@ -8387,7 +8387,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if is_project_dir(project_dir): if is_project_dir(project_dir):
project = store_read_project(project_dir) project = store_read_project(project_dir)
elif is_package_dir(project_dir): elif is_package_dir(project_dir):
project_dir += '/..' project_dir = str(Path.cwd().parent)
project = store_read_project(project_dir) project = store_read_project(project_dir)
else: else:
raise oscerr.WrongArgs('Creating pbuild only works in a checked out project or package') raise oscerr.WrongArgs('Creating pbuild only works in a checked out project or package')