Skip to content

Commit 8a59bc9

Browse files
committed
remove references to python 2
1 parent 05991cf commit 8a59bc9

File tree

7 files changed

+15
-40
lines changed

7 files changed

+15
-40
lines changed

gitup/cli.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
# Copyright (C) 2011-2018 Ben Kurtovic <ben.kurtovic@gmail.com>
44
# Released under the terms of the MIT License. See LICENSE for details.
55

6-
from __future__ import print_function
7-
86
import argparse
97
import os
108
import platform
11-
import sys
129

1310
from colorama import init as color_init, Style
1411

@@ -17,11 +14,6 @@
1714
delete_bookmarks, list_bookmarks, clean_bookmarks)
1815
from gitup.update import update_bookmarks, update_directories, run_command
1916

20-
def _decode(path):
21-
"""Decode the given string using the system's filesystem encoding."""
22-
if sys.version_info.major > 2:
23-
return path
24-
return path.decode(sys.getfilesystemencoding())
2517

2618
def _build_parser():
2719
"""Build and return the argument parser."""
@@ -39,7 +31,7 @@ def _build_parser():
3931
group_m = parser.add_argument_group("miscellaneous")
4032

4133
group_u.add_argument(
42-
'directories_to_update', nargs="*", metavar="path", type=_decode,
34+
'directories_to_update', nargs="*", metavar="path",
4335
help="""update this repository, or all repositories it contains
4436
(if not a repo directly)""")
4537
group_u.add_argument(
@@ -60,11 +52,9 @@ def _build_parser():
6052
remote-tracking branches that no longer exist on their remote""")
6153

6254
group_b.add_argument(
63-
'-a', '--add', dest="bookmarks_to_add", nargs="+", metavar="path",
64-
type=_decode, help="add directory(s) as bookmarks")
55+
'-a', '--add', dest="bookmarks_to_add", nargs="+", metavar="path", help="add directory(s) as bookmarks")
6556
group_b.add_argument(
6657
'-d', '--delete', dest="bookmarks_to_del", nargs="+", metavar="path",
67-
type=_decode,
6858
help="delete bookmark(s) (leaves actual directories alone)")
6959
group_b.add_argument(
7060
'-l', '--list', dest="list_bookmarks", action="store_true",
@@ -73,7 +63,7 @@ def _build_parser():
7363
'-n', '--clean', '--cleanup', dest="clean_bookmarks",
7464
action="store_true", help="delete any bookmarks that don't exist")
7565
group_b.add_argument(
76-
'-b', '--bookmark-file', nargs="?", metavar="path", type=_decode,
66+
'-b', '--bookmark-file', nargs="?", metavar="path",
7767
help="use a specific bookmark config file (default: {0})".format(
7868
get_default_config_path()))
7969

gitup/config.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Copyright (C) 2011-2018 Ben Kurtovic <ben.kurtovic@gmail.com>
44
# Released under the terms of the MIT License. See LICENSE for details.
55

6-
from __future__ import print_function
7-
86
from glob import glob
97
import os
108

gitup/migrate.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,7 @@
55

66
import os
77

8-
try:
9-
from configparser import ConfigParser, NoSectionError
10-
PY3K = True
11-
except ImportError: # Python 2
12-
from ConfigParser import SafeConfigParser as ConfigParser, NoSectionError
13-
PY3K = False
8+
from configparser import ConfigParser, NoSectionError
149

1510
__all__ = ["run_migrations"]
1611

@@ -37,16 +32,14 @@ def _migrate_old_format():
3732
if not os.path.exists(old_path):
3833
return
3934

40-
config = ConfigParser(delimiters="=") if PY3K else ConfigParser()
35+
config = ConfigParser(delimiters="=")
4136
config.optionxform = lambda opt: opt
4237
config.read(old_path)
4338

4439
try:
45-
bookmarks = [path for path, _ in config.items("bookmarks")]
40+
bookmarks = [path.encode("utf8") for path, _ in config.items("bookmarks")]
4641
except NoSectionError:
4742
bookmarks = []
48-
if PY3K:
49-
bookmarks = [path.encode("utf8") for path in bookmarks]
5043

5144
new_path = os.path.join(os.path.split(old_path)[0], "bookmarks")
5245
os.rename(old_path, new_path)

gitup/test/test_bookmarks.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Copyright (C) 2011-2018 Ben Kurtovic <ben.kurtovic@gmail.com>
44
# Released under the terms of the MIT License. See LICENSE for details.
55

6-
from __future__ import print_function, unicode_literals
7-
86
from gitup import config
97

108
def test_empty_list(tmpdir, capsys):

gitup/test/test_cli.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# Copyright (C) 2011-2018 Ben Kurtovic <ben.kurtovic@gmail.com>
44
# Released under the terms of the MIT License. See LICENSE for details.
55

6-
from __future__ import print_function, unicode_literals
7-
86
import platform
97
import subprocess
108
import sys

gitup/update.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@
22
#
33
# Copyright (C) 2011-2018 Ben Kurtovic <ben.kurtovic@gmail.com>
44
# Released under the terms of the MIT License. See LICENSE for details.
5-
6-
from __future__ import print_function
7-
5+
import logging
86
from glob import glob
97
import os
108
import re
@@ -14,6 +12,8 @@
1412
from git import RemoteReference as RemoteRef, Repo, exc
1513
from git.util import RemoteProgress
1614

15+
logger = logging.getLogger(__name__)
16+
1717
__all__ = ["update_bookmarks", "update_directories", "run_command"]
1818

1919
BOLD = Style.BRIGHT
@@ -126,6 +126,7 @@ def _update_branch(repo, branch, is_active=False):
126126
try:
127127
base = repo.git.merge_base(branch.commit, upstream.commit)
128128
except exc.GitCommandError as err:
129+
logger.debug(err)
129130
print(YELLOW + "skipped:", "can't find merge base with upstream.")
130131
return
131132

setup.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@
77

88
from setuptools import setup, find_packages
99

10-
if sys.hexversion < 0x02070000:
11-
exit("Please upgrade to Python 2.7 or greater: <https://www.python.org/>.")
12-
1310
from gitup import __version__
1411

1512
with open('README.md') as fp:
@@ -39,12 +36,12 @@
3936
"Operating System :: POSIX",
4037
"Operating System :: Microsoft :: Windows",
4138
"Programming Language :: Python",
42-
"Programming Language :: Python :: 2.7",
4339
"Programming Language :: Python :: 3",
44-
"Programming Language :: Python :: 3.4",
45-
"Programming Language :: Python :: 3.5",
46-
"Programming Language :: Python :: 3.6",
47-
"Programming Language :: Python :: 3.7",
40+
"Programming Language :: Python :: 3.9",
41+
"Programming Language :: Python :: 3.10",
42+
"Programming Language :: Python :: 3.11",
43+
"Programming Language :: Python :: 3.12",
44+
"Programming Language :: Python :: 3.13",
4845
"Topic :: Software Development :: Version Control :: Git"
4946
]
5047
)

0 commit comments

Comments
 (0)