Completed
Push — dev ( b102e3...5e6199 )
by
unknown
26s queued 15s
created

demandregio.install_disaggregator   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 26
dl 0
loc 44
rs 10
c 0
b 0
f 0
wmc 2

1 Function

Rating   Name   Duplication   Size   Complexity  
A clone_and_install() 0 34 2
1
"""This module downloads and installs demandregio's disaggregator from GitHub
2
3
"""
4
import os
5
import egon.data.config
6
from egon.data import  subprocess
7
from pathlib import Path
8
9
10
def clone_and_install():
11
    """ Clone and install repository of demandregio's disaggregator
12
13
    Returns
14
    -------
15
    None.
16
17
    """
18
19
    source = egon.data.config.datasets()['demandregio_installation']['sources']
20
21
    repo_path = Path(".") / (egon.data.config.datasets()
22
                   ['demandregio_installation']['targets']["path"])
23
24
    if not os.path.exists(repo_path):
25
        os.mkdir(repo_path)
26
        subprocess.run(
27
            [
28
                "git",
29
                "clone",
30
                "--single-branch",
31
                "--branch",
32
                source["branch"],
33
                source["git-repository"],
34
            ],
35
            cwd=repo_path
36
        )
37
38
        subprocess.run(
39
            [
40
                "pip",
41
                "install",
42
                "-e",
43
                (repo_path/'disaggregator').absolute(),
44
            ],
45
        )