Skip to content

Commit

Permalink
ci: Update configs for src/ layout
Browse files Browse the repository at this point in the history
  • Loading branch information
tony committed Sep 11, 2022
1 parent e1872f2 commit e978acc
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
11 changes: 7 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,14 @@
# Get the project root dir, which is the parent dir of this
cwd = Path(__file__).parent
project_root = cwd.parent
src_root = project_root / "src"

sys.path.insert(0, str(project_root))
sys.path.insert(0, str(src_root))
sys.path.insert(0, str(cwd / "_ext"))

# package data
about: t.Dict[str, str] = {}
with open(project_root / "unihan_db" / "__about__.py") as fp:
with open(src_root / "unihan_db" / "__about__.py") as fp:
exec(fp.read(), about)


Expand Down Expand Up @@ -208,16 +209,18 @@ def linkcode_resolve(domain, info): # NOQA: C901
fn = relpath(fn, start=dirname(unihan_db.__file__))

if "dev" in about["__version__"]:
return "{}/blob/master/{}/{}{}".format(
return "{}/blob/master/{}/{}/{}{}".format(
about["__github__"],
"src",
about["__package_name__"],
fn,
linespec,
)
else:
return "{}/blob/v{}/{}/{}{}".format(
return "{}/blob/v{}/{}/{}/{}{}".format(
about["__github__"],
about["__version__"],
"src",
about["__package_name__"],
fn,
linespec,
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ keywords = [

readme = "README.md"
packages = [
{ include = "unihan_db" },
{ include = "*", from = "src" },
]
include = [
{ path = "tests", format = "sdist" },
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ line_length = 88
addopts = --reruns=0 --tb=short --no-header --showlocals --doctest-modules
doctest_optionflags = ELLIPSIS NORMALIZE_WHITESPACE
testpaths =
unihan_db
src/unihan_db
tests
docs

0 comments on commit e978acc

Please sign in to comment.