From 789124aae8798173ffa1711c4851e83b4b4f976a Mon Sep 17 00:00:00 2001 From: kaliko Date: Fri, 9 Feb 2024 17:00:08 +0100 Subject: [PATCH] Remove vinstall.py --- .gitlab-ci.yml | 10 --- INSTALL | 24 ------- MANIFEST.in | 1 - doc/Changelog | 6 ++ doc/source/user/00_install.rst | 33 --------- vinstall.py | 118 --------------------------------- 6 files changed, 6 insertions(+), 186 deletions(-) delete mode 100644 INSTALL delete mode 100755 vinstall.py diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fde280f..ad63ee2 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -58,16 +58,6 @@ unittests: reports: junit: report.xml -vinstall: - stage: test - script: - # test virtualenv install - - python3 ./vinstall.py - # smoke test - - ./vmpd-sima --help - artifacts: - expire_in: 1 hour - tag_release: stage: build dependencies: diff --git a/INSTALL b/INSTALL deleted file mode 100644 index bdd3f84..0000000 --- a/INSTALL +++ /dev/null @@ -1,24 +0,0 @@ -Designed for python3 >= 3.6 - -Requires: python-musicpd [0], - requests [1] - - [0] https://pypi.org/project/python-musicpd/ - [1] http://docs.python-requests.org/ - - -Virtualenv installation from source: - - Run "python3 ./vinstall.py" from the source to generate the python virtualenv and install - requirements. - - It will setup a virtualenv within a "venv" directory (same level as vinstall.py file). - It should also write a shell wrapper to run mpd-sima within the virtualenv. - - ./vmpd-sima --help - -Virtualenv installation with pip: - - python3 -m venv mpd-sima - ./mpd-sima/bin/pip install MPD-sima - ./mpd-sima/bin/mpd-sima --help diff --git a/MANIFEST.in b/MANIFEST.in index 7f4b5f8..bb94c01 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,3 @@ recursive-include data * recursive-include doc * include README include INSTALL -include vinstall.py diff --git a/doc/Changelog b/doc/Changelog index 8bba3b1..7b9cf8b 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,9 @@ +MPD_sima v0.19.0 + + * Remove vinstall.py + + -- kaliko + MPD_sima v0.18.2 * Add positional argument: diff --git a/doc/source/user/00_install.rst b/doc/source/user/00_install.rst index 703b8db..202f1a6 100644 --- a/doc/source/user/00_install.rst +++ b/doc/source/user/00_install.rst @@ -21,37 +21,4 @@ Python virtualenv # Print help message mpd-sima --help -From Source ------------ - -Virtualenv installation from source: - -Run ``python ./vinstall.py`` from the source to generate the python virtualenv and install requirements. - -It will setup a virtualenv within a "venv" directory (same level as vinstall.py file). It should also write a shell wrapper to run mpd-sima within the virtualenv. - - -.. code:: bash - - # Clone master branch - git clone -b master git@gitlab.com:kaliko/sima.git - # setup virtualenv - python ./vinstall.py - ./vmpd-sima --help - -To restart from scratch or pull latest changes - -.. code:: bash - - # Get into the local git repo (here sima directory) - cd sima - # Remove virtualenv - rm -rf ./venv - # Fetch and merge latest changes - git pull - # setup virtualenv - python ./vinstall.py - ./vmpd-sima --help - - .. vim: spell spelllang=en diff --git a/vinstall.py b/vinstall.py deleted file mode 100755 index afbb0e3..0000000 --- a/vinstall.py +++ /dev/null @@ -1,118 +0,0 @@ -#!/usr/bin/env python3 -# Copyright (C) 2013 Vinay Sajip. New BSD License. -# Copyright (C) 2014, 2021 kaliko -# - -REQ_VER = (3,6) -import sys -if sys.version_info < REQ_VER: - print('Need at least python {0}.{1} to run this script'.format(*REQ_VER), file=sys.stderr) - sys.exit(1) - -import os -import os.path -import venv - -from subprocess import Popen, PIPE -from threading import Thread -from urllib.parse import urlparse -from urllib.request import urlretrieve -from shutil import rmtree - -class ExtendedEnvBuilder(venv.EnvBuilder): - """ - This builder installs setuptools and pip so that you can pip or - easy_install other packages into the created environment. - """ - - def __init__(self, *args, **kwargs): - self.verbose = kwargs.pop('verbose', False) - super().__init__(*args, **kwargs) - - def post_setup(self, context): - """ - Set up any packages which need to be pre-installed into the - environment being created. - - :param context: The information for the environment creation request - being processed. - """ - os.environ['VIRTUAL_ENV'] = context.env_dir - setup = os.path.abspath(os.path.join(context.env_dir, '../setup.py')) - self.install_script(context, 'sima', setup=setup) - - def reader(self, stream, context): - """ - Read lines from a subprocess' output stream and write progress - information to sys.stderr. - """ - while True: - s = stream.readline() - if not s: - break - if not self.verbose: - sys.stderr.write('.') - else: - sys.stderr.write(s.decode('utf-8')) - sys.stderr.flush() - stream.close() - - def install_script(self, context, name, url=None, setup=None): - if url: - binpath = context.bin_path - _, _, path, _, _, _ = urlparse(url) - fn = os.path.split(path)[-1] - distpath = os.path.join(binpath, fn) - # Download script into the env's binaries folder - urlretrieve(url, distpath) - if url: - args = [context.env_exe, fn] - else: - args = [context.env_exe, setup, 'install'] - binpath = os.path.dirname(setup) - if self.verbose: - term = '\n' - else: - term = '' - sys.stderr.write('Installing %s ...%s' % (name, term)) - sys.stderr.flush() - # Install in the env - p = Popen(args, stdout=PIPE, stderr=PIPE, cwd=binpath) - t1 = Thread(target=self.reader, args=(p.stdout, 'stdout')) - t1.start() - t2 = Thread(target=self.reader, args=(p.stderr, 'stderr')) - t2.start() - p.wait() - t1.join() - t2.join() - sys.stderr.write('done.\n') - if url: - # Clean up - no longer needed - os.unlink(distpath) - - -def main(): - root = os.path.dirname(os.path.abspath(__file__)) - vdir = os.path.join(root, 'venv') - builder = ExtendedEnvBuilder(clear=True, verbose=False, with_pip=True) - builder.create(vdir) - # clean up - for residu in ['MPD_sima.egg-info', 'dist', 'build']: - if os.path.exists(os.path.join(root, residu)): - rmtree(os.path.join(root, residu)) - # Write wrapper - with open(os.path.join(root, 'vmpd-sima'),'w') as fd: - fd.write('#!/bin/sh\n') - fd.write(f'. "{root}/venv/bin/activate"\n') - fd.write(f'"{root}/venv/bin/mpd-sima" "$@"') - os.chmod(os.path.join(root, 'vmpd-sima'), 0o744) - - -if __name__ == '__main__': - rc = 1 - try: - main() - rc = 0 - except ImportError as e: - print(f'Error: {e}') - sys.exit(rc) -- 2.39.5