Skip to content

Commit

Permalink
general: use python2 (sys.executable), not python (PEP 394)
Browse files Browse the repository at this point in the history
Hopefully there is no major roadblock making this change unreasonable at
this point in time (checked commonly used RHEL, Fedora, Debian/Ubuntu
--  the latter also for seamless integration with Travis CI).

Signed-off-by: Jan Pokorný <[email protected]>
  • Loading branch information
jnpkrn committed Apr 7, 2015
1 parent 6c77f9a commit 825aafc
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 18 deletions.
11 changes: 6 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ before_install:
# https://github.com/travis-ci/travis-ci/issues/2124#issuecomment-38992012
- sudo apt-get update -qq
# speed the run up
- python -c
- python2 -c
'from sys import exit, version_info as v; exit(v[:2] in ((2, 7), (3, 2)))'
|| sudo apt-get install -qq python-lxml python-distribute
install:
- cd __root__
- python setup.py -q saveopts -f setup.cfg pkg_prepare
--ra-metadata-dir="$(pwd)/cluster"
--ccs-flatten="$(dirname $(pwd))/ccs_flatten"
--editor="sed -i 's|\(force-block=\"\)false|\1true|;w /dev/stdout'"
- python2 setup.py -q
saveopts -f setup.cfg pkg_prepare
--ra-metadata-dir="$(pwd)/cluster"
--ccs-flatten="$(dirname $(pwd))/ccs_flatten"
--editor="sed -i 's|\(force-block=\"\)false|\1true|;w /dev/stdout'"
#- cat setup.cfg
# make following robust enough to deal with pip pre-6.0(?)
- true;{
Expand Down
9 changes: 5 additions & 4 deletions __main__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
# -*- coding: UTF-8 -*-
# Copyright 2014 Red Hat, Inc.
# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""Machinery entry point -- to be run via python -m <package>"""
"""Machinery entry point -- to be run via python{,2} -m <package>"""
__author__ = "Jan Pokorný <jpokorny @at@ Red Hat .dot. com>"

from os.path import basename
from sys import argv, exit
from sys import argv, executable, exit

from .main import run

if basename(argv[0]) == '__main__.py':
argv[0] = 'python -m ' + __package__
# for help screens only, hence spaces allowed
argv[0] = "{0} -m {1}".format(executable, __package__)
exit(run(argv))
2 changes: 1 addition & 1 deletion __root__/doc/HACKING
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Directly consuming the repo
---------------------------

After fetching local repo copy:
$ python setup.py build
$ python setup.py build # or python2 if it matters
$ ln -fs __root__/build/ccs_flatten .
$ # or ./run-check that should take care on its own
and you should be ready to go with:
Expand Down
2 changes: 1 addition & 1 deletion __root__/run-check
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ PATH="${PATH:+${PATH}:}$(
)"
unset s

PYTHONEXEC="python -Es"
PYTHONEXEC="python2 -Es"

echo "Current path: ${PATH}"
which ccs_flatten 2>/dev/null || (
Expand Down
4 changes: 2 additions & 2 deletions __root__/run-dev
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# Copyright 2014 Red Hat, Inc.
# Copyright 2015 Red Hat, Inc.
# Part of clufter project
# Licensed under GPLv2+ (a copy included | http://gnu.org/licenses/gpl-2.0.txt)
"""Machinery entry point -- to be run from in-repo location"""
Expand Down
2 changes: 1 addition & 1 deletion __root__/run-sdist
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ pushd "$(git rev-parse --show-toplevel)"
git archive --format=tar HEAD | (
cd $(mktemp -d '/var/tmp/pkg-XXXXX') \
&& tar xf - \
&& python setup.py sdist -d "${OLDPWD}/__root__/dist")
&& python2 setup.py sdist -d "${OLDPWD}/__root__/dist")
echo "New source tarball created: $(ls -1t __root__/dist | head -n1)"
popd
6 changes: 3 additions & 3 deletions misc/clufter.spec
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# distill-spec-prefix: clufter
%{!?clufter_version: %global clufter_version %{?!infer:0.10.4}%{?infer:%(
python ../setup.py --version)}}
python2 ../setup.py --version)}}
%{!?clufter_name: %global clufter_name %{?!infer:clufter}%{?infer:%(
python ../setup.py --name)}}
python2 ../setup.py --name)}}
%{!?clufter_license: %global clufter_license %{?!infer:GPLv2+}%{?infer:%(
python ../setup.py --license)}}
python2 ../setup.py --license)}}
%{!?clufter_check: %global clufter_check 1}

# special vars wrt. versioning
Expand Down
2 changes: 1 addition & 1 deletion misc/run-sdist-per-commit
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ pushd "$(LC=C \
-e 's|.*filename=\([^-]\+-[^-]\+-\)\(v[^g]\+\)\?g\([0-9a-z]\+\)\.tar\.gz|\1\3|' \
| tr -d '\r\n'
)/__root__"
python setup.py sdist -d "${OLDPWD}"
python2 setup.py sdist -d "${OLDPWD}"
popd
echo "New source tarball created: $(ls -1t | head -n1)"

0 comments on commit 825aafc

Please sign in to comment.