Project

General

Profile

Download (1.89 KB) Statistics
| Branch: | Tag: | Revision:

hydrilla-builder / src / hydrilla / builder / __main__.py @ 7fc29bde

1
# SPDX-License-Identifier: AGPL-3.0-or-later
2

    
3
# Command line interface of Hydrilla package builder.
4
#
5
# This file is part of Hydrilla
6
#
7
# Copyright (C) 2022 Wojtek Kosior
8
#
9
# This program is free software: you can redistribute it and/or modify
10
# it under the terms of the GNU Affero General Public License as
11
# published by the Free Software Foundation, either version 3 of the
12
# License, or (at your option) any later version.
13
#
14
# This program is distributed in the hope that it will be useful,
15
# but WITHOUT ANY WARRANTY; without even the implied warranty of
16
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
# GNU Affero General Public License for more details.
18
#
19
# You should have received a copy of the GNU Affero General Public License
20
# along with this program.  If not, see <https://www.gnu.org/licenses/>.
21
#
22
#
23
# I, Wojtek Kosior, thereby promise not to sue for violation of this
24
# file's license. Although I request that you do not make use this code
25
# in a proprietary program, I am not going to enforce this in court.
26

    
27
from pathlib import Path
28

    
29
import click
30

    
31
from .build import Build
32

    
33
dir_type = click.Path(exists=True, file_okay=False, resolve_path=True)
34

    
35
@click.command()
36
@click.option('-s', '--srcdir', default='./', type=dir_type, show_default=True,
37
              help='Source directory to build from.')
38
@click.option('-i', '--index-json', default='index.json', type=click.Path(),
39
              help='Path to file to be processed instead of index.json (if not absolute, resolved relative to srcdir).')
40
@click.option('-d', '--dstdir', type=dir_type, required=True,
41
              help='Destination directory to write built package files to.')
42
def preform_build(srcdir, index_json, dstdir):
43
    """
44
    Build Hydrilla package from scrdir and write the resulting files under
45
    dstdir.
46
    """
47
    build = Build(Path(srcdir), Path(index_json))
48
    build.write_package_files(Path(dstdir))
49

    
50
preform_build()
(2-2/3)