Modernize developer installation

Support the popular pip editable installation mode.

To work-around a problem in setuptools' develop target, generalize
'install_dir' to say all packages are in 'src' (for more info, see:
https://github.com/pypa/pip/issues/126).

Remove pre-generated bin/tito-dev script.
This commit is contained in:
Tadej Janež 2017-02-01 15:46:43 +01:00
parent 46bc5ab1a1
commit 6f5a455aac
No known key found for this signature in database
GPG key ID: 37B064855C101C1B
4 changed files with 12 additions and 42 deletions

1
.gitignore vendored
View file

@ -25,3 +25,4 @@ include
lib lib
local local
hacking/*/tito.spec hacking/*/tito.spec
tito-venv/

11
HACKING
View file

@ -106,8 +106,15 @@ Then from the root of the project:
When developing code for tito there are a couple ways you can test: When developing code for tito there are a couple ways you can test:
"bin/tito-dev" is a script that will run code from the local checkout First install Tito's dependencies for your architecture, i.e. `x86_64`, like
rather than what is installed on the system. described in [README's INSTALL section](README.md#INSTALL), under installation
from git's `master` branch.
Then create a virtual environment and install tito in editable mode:
python3 -m venv --system-site-packages tito-venv
source tito-venv/bin/activate
pip install -e .
And of course, you can always use the installed tito to replace And of course, you can always use the installed tito to replace
itself with a test build of the latest *committed* code in your itself with a test build of the latest *committed* code in your

View file

@ -1,39 +0,0 @@
#!/usr/bin/python
#
# Copyright (c) 2008,2009 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
# along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
#
# Red Hat trademarks are not licensed under GPLv2. No permission is
# granted to use or replicate Red Hat trademarks that are incorporated
# in this software or its documentation.
#
"""
A Tito development script to run from source.
This script should only ever be called from bin/ in a source checkout.
"""
import sys
import os.path
# We know this script is in bin/
SCRIPT_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../"))
SRC_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, "src/"))
SRC_BIN_DIR = os.path.abspath(os.path.join(SCRIPT_DIR, "bin/"))
sys.path.insert(0, SRC_DIR)
os.environ['TITO_SRC_BIN_DIR'] = SRC_BIN_DIR
from tito.cli import CLI
if __name__ == "__main__":
CLI().main(sys.argv[1:])

View file

@ -28,8 +28,9 @@ setup(
url='http://rm-rf.ca/tito', url='http://rm-rf.ca/tito',
license='GPLv2+', license='GPLv2+',
# tell distutils packages are under src directory
package_dir={ package_dir={
'tito': 'src/tito', '': 'src',
}, },
packages=find_packages('src'), packages=find_packages('src'),
include_package_data=True, include_package_data=True,