Skip to content

Commit 1d781c1

Browse files
committed
make sure build system is initialized
1 parent 925bdf0 commit 1d781c1

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

bases/rsptx/rsmanage/core.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,6 +1258,7 @@ async def addbookauthor(config, book, author, github):
12581258
await create_course(new_course)
12591259
# Try to deduce the github url from the working directory
12601260
repo_path = None
1261+
book_path = None
12611262
if not github:
12621263
lib_entry = await fetch_library_book(book)
12631264
if lib_entry:
@@ -1287,6 +1288,15 @@ async def addbookauthor(config, book, author, github):
12871288
vals = dict(title=f"Temporary title for {book}", github_url=github)
12881289
if repo_path:
12891290
vals["repo_path"] = repo_path
1291+
else:
1292+
if not book_path:
1293+
book_path = os.environ.get("BOOK_PATH", "/books/") + "/" + book
1294+
proj_path = book_path or repo_path
1295+
if os.path.exists(os.path.join(proj_path, "project.ptx")):
1296+
vals["build_system"] = "PTX"
1297+
else:
1298+
vals["build_system"] = "Runestone"
1299+
12901300
await create_library_book(book, vals)
12911301
except Exception:
12921302
click.echo(f"Warning: Book: {book} already exists in library")

0 commit comments

Comments
 (0)