-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #37 from vkottler/dev/build-libraries
Dev/build libraries
- Loading branch information
Showing
18 changed files
with
170 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
[DESIGN] | ||
max-args=8 | ||
max-attributes=8 | ||
|
||
[MESSAGES CONTROL] | ||
disable=too-few-public-methods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
--- | ||
major: 1 | ||
minor: 10 | ||
patch: 5 | ||
major: 2 | ||
minor: 0 | ||
patch: 0 | ||
entry: mbs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
123 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ cflag_groups: | |
debug: [-Og, -g] | ||
opt: [-O2] | ||
|
||
extra_dist: [extra] | ||
|
||
project: | ||
name: yambs | ||
github: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,7 @@ properties: | |
items: | ||
type: string | ||
|
||
extra_third_party: | ||
extra_dist: | ||
type: array | ||
items: | ||
type: string | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
""" | ||
A module implementing interfaces for facilitating project distribution. | ||
""" | ||
|
||
# built-in | ||
from pathlib import Path | ||
from shutil import copy2, copytree, make_archive | ||
|
||
# third-party | ||
from vcorelib.paths.context import in_dir | ||
|
||
# internal | ||
from yambs.config.common import CommonConfig | ||
|
||
ARCHIVES = [ | ||
("tar.gz", "gztar"), | ||
("tar.xz", "xztar"), | ||
("zip", "zip"), | ||
] | ||
|
||
|
||
def make_archives(tmp: Path, config: CommonConfig) -> None: | ||
"""Create a distribution that only contains sources.""" | ||
|
||
slug = str(config.project) | ||
|
||
for ext, kind in ARCHIVES: | ||
out = tmp.joinpath(f"{slug}.{ext}") | ||
out.unlink(missing_ok=True) | ||
|
||
with in_dir(tmp): | ||
make_archive(slug, kind) | ||
|
||
assert out.is_file(), out | ||
|
||
final = config.dist_root.joinpath(out.name) | ||
copy2(out, final.resolve()) | ||
out.unlink() | ||
|
||
print(f"Created '{final}'.") | ||
|
||
|
||
def copy_source_tree(config: CommonConfig, dest: Path) -> None: | ||
""" | ||
Copy necessary parts of the project source tree to some destination | ||
directory. | ||
""" | ||
|
||
root = config.root | ||
|
||
for item in [ | ||
x | ||
for x in [ | ||
config.src_root, | ||
config.ninja_root, | ||
root.joinpath("build.ninja"), | ||
config.file, | ||
] | ||
+ [root.joinpath(x) for x in config.data.get("extra_dist", [])] | ||
if x and x.exists() | ||
]: | ||
if item.is_dir(): | ||
copytree(item, dest.joinpath(item.name)) | ||
else: | ||
copy2(item, dest.joinpath(item.name)) |
Oops, something went wrong.