1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-24 11:12:14 +01:00

Merge pull request #1187 from dirkmueller/pathlib_fixes

Fix path construction involving Path.cwd()
This commit is contained in:
Daniel Mach 2022-10-31 10:57:29 +01:00 committed by GitHub
commit d4e57798d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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')