-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix dh_make call for Debian packaging #73
Conversation
dh_make recently changed from Python 2 to Python 3. For this reason, the call to dh_make with Python 2 won’t work on systems with new dh_make versions. Instead of locking the Python version to Python 2, call Python without the fixed version number. This should be safe, because we can expect Linux distributions to ship a version of dh_make that works with the system’s default Python version.
@@ -12,7 +12,7 @@ all: clean | |||
cd $(BUILDDIR) && \ | |||
export DEBEMAIL=$(EMAIL) && \ | |||
export DEBFULLNAME=$(MAINTAINER) && \ | |||
python2 /usr/bin/dh_make -p $(PKGNAME)_$(PKGVERSION) -i --native -c mit -y && \ | |||
python /usr/bin/dh_make -p $(PKGNAME)_$(PKGVERSION) -i --native -c mit -y && \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would happen if I have the wrong Python version? Would it scream loud or error silently?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Calling dh_make
with the wrong Python version results in errors.
dh_make
2.201701 (the new version) with Python 2 gives a module dependency error:
Traceback (most recent call last):
File "/usr/bin/dh_make", line 16, in <module>
from enum import Enum
ImportError: No module named enum
dh_make
2.201608 (the old version) with Python 3 even results in a syntax error:
File "dh_make", line 715
os.mkdir('source', 0755)
^
SyntaxError: invalid token
So in both cases, we get an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
However, we should, perhaps, require dh_make
to succeed for any of the later commands. In this way, make would get an error exit code and report the version mismatch more nicely.
Currently, the result would be a file not found
error toward the end of the Makefile.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way, I’d like to call dh_make
without python
and to rely on a proper shebang declaration. However, dh_make
as of 2.201608 declares /usr/bin/python
as its interpreter without specifying the required Python version explicitly. This is unfortunate, because now, we have to care about the correct version. However, dh_make
2.201701 has a proper interpreter directive (/usr/bin/python3
).
dh_make
recently changed from Python 2 to Python 3. For this reason, the call todh_make
with Python 2 won’t work on systems with newdh_make
versions. Instead of locking the Python version to Python 2, call Python without the fixed version number. This should be safe, because we can expect Linux distributions to ship a version ofdh_make
that works with the system’s default Python version.