Commit 9b4ff95b authored by Hristos N. Triantafillou's avatar Hristos N. Triantafillou Committed by Benjamin Winger

Use setuptools for installation (#34)

Use setuptools entry point scripts for installation, preserve local
binscripts for a 'local' install.
parent f52cee60
Pipeline #61455091 (#63) passed with stages
in 3 minutes and 56 seconds
......@@ -28,9 +28,9 @@ before_script:
inquisitor:
stage: test
script:
- mwmerge.py --sync
- omwmerge --sync
- cd ~/.local/share/portmod/openmw
- inquisitor.py
- inquisitor
install:
stage: build
......
......@@ -21,10 +21,22 @@ https://gitlab.com/bmwinger/omwcmd
## Installing on Linux
To install into `/usr/bin` (requires root), run
```sudo ./setup.py install```
git clone https://gitlab.com/portmod/portmod
sudo pip3 install /path/to/portmod
Or, directly from Gitlab:
sudo pip3 install git+https://gitlab.com/portmod/portmod
To install into `~/.local/bin`, run
```./setup.py install --user```
git clone https://gitlab.com/portmod/portmod
pip3 install --user --upgrade /path/to/portmod
Or, directly from Gitlab:
pip3 install --user --upgrade git+https://gitlab.com/portmod/portmod
You will want to create a config file in ~/.config/portmod/portmod.cfg. A sample is included in the root of the repository. Primarily you will want to set the USE variable and the ARCH variable to reflect your openmw setup.
......@@ -41,11 +53,11 @@ https://git-scm.com/download/win
Before installing other mods, you should explicitly install the morrowind mod. This pybuild automatically detects the location of your morrowind installation and "installs it" by creating a softlink to this installation. This is done so that the morrowind data files can be treated just like other data files. You may also want to install omwllf to merge levelled lists.
Mods can be installed by passing the relevant atoms as command line arguments. E.g.:
`mwmerge morrowind omwllf`
`omwmerge morrowind omwllf`
You can search for mods using the `--search`/`-s` (searches name only) and `--searchdesc`/`-S` (searches name and description) options.
Specific versions of mods can be installed by including the version number: `mwmerge abandoned-flat-2.0`
Specific versions of mods can be installed by including the version number: `omwmerge abandoned-flat-2.0`
Specified mods will be automatically be downloaded, configured and installed.
......
#!/usr/bin/python3
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
)
):
sys.path.insert(0, osp.dirname(osp.dirname(osp.realpath(__file__))))
from portmod.inquisitor import main
main()
#!/usr/bin/python3
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
)
):
sys.path.insert(0, osp.dirname(osp.dirname(osp.realpath(__file__))))
from portmod.omwmerge import main
main()
......@@ -6,6 +6,7 @@
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
......
......@@ -6,6 +6,7 @@
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
......
#!/usr/bin/python3
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
)
):
sys.path.insert(0, osp.dirname(osp.dirname(osp.realpath(__file__))))
from portmod.omwuse import main
main()
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
import shutil
import subprocess
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
......@@ -16,16 +15,6 @@ if __name__ == "__main__":
):
sys.path.insert(0, osp.dirname(osp.dirname(osp.realpath(__file__))))
from portmod.config import find_config, read_config
config = read_config()
mod_dirs = [directory for (index, directory) in find_config(config, "data", "*")]
args = ["dcv"]
args.extend(mod_dirs)
from portmod.openmw_conflicts import main
if shutil.which("dcv"):
subprocess.Popen(args).wait()
else:
print('Error: Could not find "dcv"')
main()
#!/usr/bin/python3
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
import sys
from os import path as osp
if __name__ == "__main__":
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
)
):
sys.path.insert(0, osp.dirname(osp.dirname(osp.realpath(__file__))))
from portmod.omwpybuild import main
main()
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
from portmod.globals import OPENMW_CONFIG, OPENMW_CONFIG_DIR
from .globals import OPENMW_CONFIG, OPENMW_CONFIG_DIR
import fnmatch
import shutil
import re
......
......@@ -8,7 +8,8 @@ import sys
import argparse
from os import path as osp
if __name__ == "__main__":
def main():
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
......@@ -179,3 +180,7 @@ if __name__ == "__main__":
if error:
exit(1)
if __name__ == "__main__":
main()
......@@ -7,7 +7,8 @@ import sys
import os
from os import path as osp
if __name__ == "__main__":
def main():
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
......@@ -18,6 +19,10 @@ if __name__ == "__main__":
# Avoid buffering so that we can read from other processes as they output
os.environ["PYTHONUNBUFFERED"] = "1"
from portmod.main import main
from portmod.main import main as portmod_main
portmod_main()
if __name__ == "__main__":
main()
......@@ -7,7 +7,8 @@ import sys
import argparse
from os import path as osp
if __name__ == "__main__":
def main():
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
......@@ -19,9 +20,9 @@ if __name__ == "__main__":
import portmod.globals
from portmod.repo.loader import load_file
from portmod.repo.download import download_mod
from portmod.log import err
from portmod.mod import install_mod, remove_mod
from portmod.main import pybuild_validate, pybuild_manifest
from portmod.log import err
parser = argparse.ArgumentParser(
description="Command line interface to interact with pybuilds"
......@@ -72,3 +73,7 @@ if __name__ == "__main__":
if args.debug:
traceback.print_exc()
err("{}".format(e))
if __name__ == "__main__":
main()
......@@ -7,7 +7,8 @@ import sys
import argparse
from os import path as osp
if __name__ == "__main__":
def main():
if osp.isfile(
osp.join(
osp.dirname(osp.dirname(osp.realpath(__file__))), ".portmod_not_installed"
......@@ -63,3 +64,7 @@ if __name__ == "__main__":
if args.debug:
traceback.print_exc()
err("{}".format(e))
if __name__ == "__main__":
main()
#!/usr/bin/python
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
import shutil
import subprocess
from portmod.config import find_config, read_config
def main():
config = read_config()
mod_dirs = [directory for (index, directory) in find_config(config, "data", "*")]
args = ["dcv"]
args.extend(mod_dirs)
if shutil.which("dcv"):
subprocess.Popen(args).wait()
else:
print('Error: Could not find "dcv"')
if __name__ == "__main__":
main()
# Copyright 2019 Portmod Authors
# Distributed under the terms of the GNU General Public License v3
from portmod.repo.atom import Atom # noqa # pylint: disable=unused-import
from .atom import Atom # noqa # pylint: disable=unused-import
......@@ -6,8 +6,8 @@ from typing import AbstractSet, Any, Callable, List, Optional, Type
import os
import configparser
from portmod.globals import GLOBAL_USE, PORTMOD_CONFIG_DIR, PORTMOD_CONFIG
import portmod.repo.loader as loader
from portmod.repo.util import select_mod
from portmod.repo import loader
from portmod.repo.flags import get_flags, add_flag, remove_flag
from portmod.repo.textures import select_texture_size
from portmod.repo.atom import Atom, InvalidAtom, useflag_re
......
[build-system]
# Minimum requirements for the build system to execute.
requires = []
requires = ["setuptools", "wheel"]
[tool.black]
line-length = 88
......
......@@ -4,20 +4,28 @@
# Distributed under the terms of the GNU General Public License v3
from distutils.core import setup
from setuptools import setup
setup(
name="portmod",
version="1.0",
author="Portmod Authors",
description="https://gitlab.com/portmod/portmod",
download_url="A CLI tool to manage mods for OpenMW",
license="GPLv3",
url="https://gitlab.com/portmod/portmod",
scripts=[
"bin/inquisitor.py",
"bin/mwmerge.py",
"bin/mwuse.py",
"bin/openmw-conflicts",
"bin/pybuild.py",
"bin/mwmirror.py",
"bin/mwmigrate.py",
],
packages=["portmod", "portmod.repo", "portmod.pybuild"],
entry_points=(
{
"console_scripts": [
"inquisitor = portmod.inquisitor:main",
"omwmerge = portmod.omwmerge:main",
"omwmigrate = portmod.migrate:migrate",
"omwmirror = portmod.mirror:mirror",
"omwuse = portmod.omwuse:main",
"openmw-conflicts = portmod.openmw_conflicts:main",
"pybuild = portmod.omwpybuild:main",
]
}
),
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment