mirror of
https://github.com/openSUSE/osc.git
synced 2025-08-21 14:08:52 +02:00
- try to read the package name first in order to raise a more appropriate exception
- minor restructuring
This commit is contained in:
38
osc/core.py
38
osc/core.py
@@ -698,8 +698,8 @@ class Package:
|
|||||||
|
|
||||||
check_store_version(self.dir)
|
check_store_version(self.dir)
|
||||||
|
|
||||||
self.prjname = store_read_project(self.dir)
|
|
||||||
self.name = store_read_package(self.dir)
|
self.name = store_read_package(self.dir)
|
||||||
|
self.prjname = store_read_project(self.dir)
|
||||||
self.apiurl = store_read_apiurl(self.dir)
|
self.apiurl = store_read_apiurl(self.dir)
|
||||||
|
|
||||||
self.update_datastructs()
|
self.update_datastructs()
|
||||||
@@ -1799,6 +1799,22 @@ def findpacs(files, progress_obj=None):
|
|||||||
return pacs
|
return pacs
|
||||||
|
|
||||||
|
|
||||||
|
def filedir_to_pac(f, progress_obj=None):
|
||||||
|
"""Takes a working copy path, or a path to a file inside a working copy,
|
||||||
|
and returns a Package object instance
|
||||||
|
|
||||||
|
If the argument was a filename, add it onto the "todo" list of the Package """
|
||||||
|
|
||||||
|
if os.path.isdir(f):
|
||||||
|
wd = f
|
||||||
|
p = Package(wd, progress_obj=progress_obj)
|
||||||
|
else:
|
||||||
|
wd = os.path.dirname(f) or os.curdir
|
||||||
|
p = Package(wd, progress_obj=progress_obj)
|
||||||
|
p.todo = [ os.path.basename(f) ]
|
||||||
|
return p
|
||||||
|
|
||||||
|
|
||||||
def read_filemeta(dir):
|
def read_filemeta(dir):
|
||||||
try:
|
try:
|
||||||
r = ET.parse(os.path.join(dir, store, '_files'))
|
r = ET.parse(os.path.join(dir, store, '_files'))
|
||||||
@@ -1840,26 +1856,6 @@ def parseargs(list_of_args):
|
|||||||
return [os.curdir]
|
return [os.curdir]
|
||||||
|
|
||||||
|
|
||||||
def filedir_to_pac(f, progress_obj=None):
|
|
||||||
"""Takes a working copy path, or a path to a file inside a working copy,
|
|
||||||
and returns a Package object instance
|
|
||||||
|
|
||||||
If the argument was a filename, add it onto the "todo" list of the Package """
|
|
||||||
|
|
||||||
if os.path.isdir(f):
|
|
||||||
wd = f
|
|
||||||
p = Package(wd, progress_obj=progress_obj)
|
|
||||||
|
|
||||||
else:
|
|
||||||
wd = os.path.dirname(f)
|
|
||||||
if wd == '':
|
|
||||||
wd = os.curdir
|
|
||||||
p = Package(wd, progress_obj=progress_obj)
|
|
||||||
p.todo = [ os.path.basename(f) ]
|
|
||||||
|
|
||||||
return p
|
|
||||||
|
|
||||||
|
|
||||||
def statfrmt(statusletter, filename):
|
def statfrmt(statusletter, filename):
|
||||||
return '%s %s' % (statusletter, filename)
|
return '%s %s' % (statusletter, filename)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user