Remove exec bits on .doc file
[LibreOffice.git] / bin / update / path.py
blob0420fa3784a0f753f83acee450c7466cc46a4081
1 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 import os
11 import subprocess
12 from sys import platform
15 def convert_to_unix(path):
16 if platform == "cygwin":
17 return subprocess.check_output(["cygpath", "-u", path]).decode("utf-8", "strict").rstrip()
18 else:
19 return path
22 def convert_to_native(path):
23 if platform == "cygwin":
24 return subprocess.check_output(["cygpath", "-m", path]).decode("utf-8", "strict").rstrip()
25 else:
26 return path
29 class UpdaterPath(object):
31 def __init__(self, workdir):
32 self._workdir = convert_to_unix(workdir)
34 def get_workdir(self):
35 return self._workdir
37 def get_update_dir(self):
38 return os.path.join(self._workdir, "update-info")
40 def get_current_build_dir(self):
41 return os.path.join(self._workdir, "mar", "current-build")
43 def get_mar_dir(self):
44 return os.path.join(self._workdir, "mar")
46 def get_previous_build_dir(self):
47 return os.path.join(self._workdir, "mar", "previous-build")
49 def get_language_dir(self):
50 return os.path.join(self.get_mar_dir(), "language")
52 def ensure_dir_exist(self):
53 os.makedirs(self.get_update_dir(), exist_ok=True)
54 os.makedirs(self.get_current_build_dir(), exist_ok=True)
55 os.makedirs(self.get_mar_dir(), exist_ok=True)
56 os.makedirs(self.get_previous_build_dir(), exist_ok=True)
57 os.makedirs(self.get_language_dir(), exist_ok=True)
59 # vim: set shiftwidth=4 softtabstop=4 expandtab: