Skip to content

Commit f025d64

Browse files
committed
config: update add_repo() and add_repo_path() for pkgcraft changes
1 parent df3e0d6 commit f025d64

3 files changed

Lines changed: 12 additions & 8 deletions

File tree

src/pkgcraft/C.pxd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,15 +227,19 @@ cdef extern from "pkgcraft.h":
227227
#
228228
# # Safety
229229
# The arguments must be valid Config and Repo pointers.
230-
Repo *pkgcraft_config_add_repo(Config *c, Repo *r)
230+
Repo *pkgcraft_config_add_repo(Config *c, Repo *r, bool external)
231231

232232
# Add local repo from filesystem path.
233233
#
234234
# Returns NULL on error.
235235
#
236236
# # Safety
237237
# The path argument should be a valid path on the system.
238-
Repo *pkgcraft_config_add_repo_path(Config *c, const char *id, int priority, const char *path)
238+
Repo *pkgcraft_config_add_repo_path(Config *c,
239+
const char *id,
240+
int priority,
241+
const char *path,
242+
bool external)
239243

240244
# Free a config.
241245
#

src/pkgcraft/config.pxd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ cdef class Config:
1010
# cached fields
1111
cdef Repos _repos
1212

13-
cdef Repo add_repo_path(self, object, object, int)
13+
cdef Repo add_repo_path(self, object, object, int, bint external=*)
1414

1515

1616
cdef class Repos:

src/pkgcraft/config.pyx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ cdef class Config:
3131
self._repos = Repos.from_config(self.ptr)
3232
return self._repos
3333

34-
cdef Repo add_repo_path(self, object path, object id, int priority):
34+
cdef Repo add_repo_path(self, object path, object id, int priority, bint external=True):
3535
"""Add an external repo via its file path and return its pointer."""
3636
path = str(path)
3737
id = str(id) if id is not None else path
3838

3939
cdef C.Repo *ptr = C.pkgcraft_config_add_repo_path(
40-
self.ptr, id.encode(), int(priority), path.encode())
40+
self.ptr, id.encode(), int(priority), path.encode(), external)
4141
if ptr is NULL:
4242
raise PkgcraftError
4343

@@ -46,13 +46,13 @@ cdef class Config:
4646

4747
return Repo.from_ptr(ptr, False)
4848

49-
def add_repo(self, repo not None, id=None, priority=0):
49+
def add_repo(self, repo not None, id=None, priority=0, external=False):
5050
"""Add an external repo via its file path or from a Repo object."""
5151
if isinstance(repo, (str, os.PathLike)):
5252
path = str(repo)
53-
return self.add_repo_path(path, id, priority)
53+
return self.add_repo_path(path, id, priority, external)
5454
else:
55-
if C.pkgcraft_config_add_repo(self.ptr, (<Repo?>repo).ptr) is NULL:
55+
if C.pkgcraft_config_add_repo(self.ptr, (<Repo?>repo).ptr, external) is NULL:
5656
raise ConfigError
5757
self._repos = None
5858
return repo

0 commit comments

Comments
 (0)