Skip to content

Commit

Permalink
Merge branch 'bugfix/upciti#7/python3-console_script_conflict'
Browse files Browse the repository at this point in the history
  • Loading branch information
hrudham committed Jul 10, 2020
2 parents 878af77 + b232fee commit 89b5e6c
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/_wheel2deb/debian.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,9 +334,25 @@ def run_install_scripts(self):
config = configparser.ConfigParser()
config.read_string(self.wheel.entrypoints)

# Some python debian packages have separate python2 and python3
# Debian packages released. If a package has a `console_scripts`
# entry, and the python2 version of a debian package is already
# installed, when we attempt to install a python3 package created
# by wheel2deb, it will fail because apt will not let it overwrite
# an existing file.
# An example of this is the `pyjwt` package: for the officially
# released Debian packages, this creates `/usr/bin/pyjwt` (apt install
# python-jwt) and `/usr/bin/pyjwt3` (apt install python3-jwt).
# The code below follows a similar pattern, by appending the python
# major version to `console_scripts` entries for versions greater
# than three.
endpoint_python_version = ""
if self.pyvers.major >= 3:
endpoint_python_version = str(self.pyvers.major)

entrypoints = {}
for section in config:
x = ['%s=%s' % k for k in config.items(section)]
x = ['%s%s=%s' % (k[0], endpoint_python_version, k[1]) for k in config.items(section)]
if x:
entrypoints[section] = x

Expand Down

0 comments on commit 89b5e6c

Please sign in to comment.