Debian Codegraph @

tasks/build_/dist.py

raw symbols SCIP
1 # -*- coding: ascii -*-
2 #
3 # Copyright 2007 - 2025
4 # Andr\xe9 Malo or his licensors, as applicable
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 """
18 Build Tasks
19 ~~~~~~~~~~~
20
21 """
22
23 import invoke as _invoke
24
25 from . import _dist
26 from . import _release
27 from . import _version
28
29 NAMESPACE = "build"
30
31
32 @_invoke.task("doc.doc")
33 def dist(ctx):
34 """Build distribution"""
35 fakeroot = ctx.shell.frompath("fakeroot")
36 with ctx.shell.root_dir():
37 ctx.shell.rm_rf("build", "dist")
38 ctx.run(
39 ctx.c("%s python setup.py sdist --formats tar,zip", fakeroot),
40 echo=True,
41 )
42
43 files = list(ctx.shell.files("dist", "*.zip"))
44 digestname = files[0][:-3] + "digests"
45 for name in ctx.shell.files("dist", "*.tar"):
46 files.append(_dist.compress(ctx, name, "gzip", ".gz"))
47 files.append(_dist.compress(ctx, name, "bzip2", ".bz2"))
48 files.append(_dist.compress(ctx, name, "xz", ".xz"))
49 ctx.shell.rm(name)
50 files = [name for name in files if name]
51
52 _dist.digest(ctx, files, digestname)
53 _dist.copy_changes(ctx)
54
55
56 @_invoke.task()
57 def version(ctx):
58 """Version"""
59 with ctx.shell.root_dir():
60 _version.update(ctx)
61
62
63 @_invoke.task("doc.doc")
64 def release(ctx):
65 """Release"""
66 with ctx.shell.root_dir():
67 _release.check_committed(ctx)
68 version(ctx)
69 _release.add_tag(ctx)
70
71 # _doc.doc(ctx) # dependencies are not called, hence put as regular
72 # dep here
73 dist(ctx)