Commit 8df410f7 authored by Julien Muchembled's avatar Julien Muchembled

Use python2 instead python and fix install for a custom Python interpreter

parent 9f01d5d1
...@@ -17,12 +17,14 @@ install: install-noinit ...@@ -17,12 +17,14 @@ install: install-noinit
done done
install-noinit: install-man install-noinit: install-man
install -Dp daemon/network-manager $(DESTDIR)$(NM)
set -e $(DESTDIR)$(PREFIX) /bin/re6stnet; [ -x $$1$$2 ] || \ set -e $(DESTDIR)$(PREFIX) /bin/re6stnet; [ -x $$1$$2 ] || \
python2.7 setup.py install --prefix=$(PREFIX) --root=$(DESTDIR); \ $(or $(PYTHON),python2) setup.py install \
--prefix=$(PREFIX) --root=$(DESTDIR); \
$(and $(PYTHON),sed -ri '1s:^#!\S+:#!$(PYTHON):' $(DESTDIR)$(NM);) \
install -d $$1/sbin; mv $$1$$2 $$1/sbin install -d $$1/sbin; mv $$1$$2 $$1/sbin
install -Dpm 0644 daemon/README.conf $(DESTDIR)/etc/re6stnet/README install -Dpm 0644 daemon/README.conf $(DESTDIR)/etc/re6stnet/README
install -Dpm 0644 daemon/logrotate.conf $(DESTDIR)/etc/logrotate.d/re6stnet install -Dpm 0644 daemon/logrotate.conf $(DESTDIR)/etc/logrotate.d/re6stnet
install -Dp daemon/network-manager $(DESTDIR)$(NM)
install-man: $(MANPAGELIST) install-man: $(MANPAGELIST)
set -e; for x in $^; \ set -e; for x in $^; \
......
#!/usr/bin/python -S #!/usr/bin/python2 -S
import errno, glob, os, signal, socket, subprocess, sys, time import errno, glob, os, signal, socket, subprocess, sys, time
DAEMON = "re6stnet" DAEMON = "re6stnet"
......
...@@ -18,7 +18,8 @@ debian/changelog: ...@@ -18,7 +18,8 @@ debian/changelog:
endif endif
override_dh_install: override_dh_install:
make DESTDIR=$(TMP) PREFIX=/usr install-noinit install-ifupdown make DESTDIR=$(TMP) PREFIX=/usr PYTHON=/usr/bin/python \
install-noinit install-ifupdown
override_dh_installinit: override_dh_installinit:
install -d $(INIT) install -d $(INIT)
......
...@@ -15,5 +15,8 @@ override_dh_python2: ...@@ -15,5 +15,8 @@ override_dh_python2:
override_dh_auto_clean: override_dh_auto_clean:
make clean make clean
# Do not build twice ('setup.py install' builds automatically)
override_dh_auto_build:
%: %:
dh $@ --with python2 --buildsystem=python_distutils dh $@ --with python2 --buildsystem=python_distutils
#!/usr/bin/python #!/usr/bin/python2
import math, nemu, os, re, signal, socket, subprocess, sys, time, weakref import math, nemu, os, re, signal, socket, subprocess, sys, time, weakref
from collections import defaultdict from collections import defaultdict
IPTABLES = 'iptables' IPTABLES = 'iptables'
......
#!/usr/bin/python #!/usr/bin/python2
import sqlite3, sys import sqlite3, sys
if 're6st' not in sys.modules: if 're6st' not in sys.modules:
import os; sys.path[0] = os.path.dirname(sys.path[0]) import os; sys.path[0] = os.path.dirname(sys.path[0])
......
#!/usr/bin/python #!/usr/bin/python2
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import argparse, httplib, select, socket, sqlite3, struct, sys, time, traceback import argparse, httplib, select, socket, sqlite3, struct, sys, time, traceback
import xml.etree.cElementTree as ET import xml.etree.cElementTree as ET
......
#!/usr/bin/python #!/usr/bin/python2
import argparse, atexit, binascii, errno, hashlib import argparse, atexit, binascii, errno, hashlib
import os, subprocess, sqlite3, sys, time import os, subprocess, sqlite3, sys, time
from OpenSSL import crypto from OpenSSL import crypto
......
#!/usr/bin/python #!/usr/bin/python2
import atexit, errno, logging, os, shutil, signal import atexit, errno, logging, os, shutil, signal
import socket, struct, subprocess, sys, time, threading import socket, struct, subprocess, sys, time, threading
from collections import deque from collections import deque
......
#!/usr/bin/python #!/usr/bin/python2
import httplib, logging, os, socket, sys import httplib, logging, os, socket, sys
from BaseHTTPServer import BaseHTTPRequestHandler from BaseHTTPServer import BaseHTTPRequestHandler
from SocketServer import ThreadingTCPServer from SocketServer import ThreadingTCPServer
......
#!/usr/bin/python -S #!/usr/bin/python2 -S
import os, sys import os, sys
script_type = os.environ['script_type'] script_type = os.environ['script_type']
......
#!/usr/bin/python -S #!/usr/bin/python2 -S
import os, sys import os, sys
script_type = os.environ['script_type'] script_type = os.environ['script_type']
......
%define _builddir %(pwd) %define _builddir %(pwd)
%define ver %(python re6st/version.py) %define ver %(python2 re6st/version.py)
%define units re6stnet.service re6st-registry.service %define units re6stnet.service re6st-registry.service
Summary: resilient, scalable, IPv6 network application Summary: resilient, scalable, IPv6 network application
......
"""Resilient, Scalable, IPv6 Network """Resilient, Scalable, IPv6 Network
""" """
import os, stat
from distutils.command.build_scripts import first_line_re
from setuptools import setup, find_packages from setuptools import setup, find_packages
from setuptools.command import sdist as _sdist, build_py as _build_py from setuptools.command import sdist as _sdist, build_py as _build_py
from distutils import log from distutils import log
...@@ -17,6 +18,19 @@ def copy_file(self, infile, outfile, *args, **kw): ...@@ -17,6 +18,19 @@ def copy_file(self, infile, outfile, *args, **kw):
if not x[0].startswith("_"): if not x[0].startswith("_"):
f.write("%s = %r\n" % x) f.write("%s = %r\n" % x)
return outfile, 1 return outfile, 1
elif isinstance(self, build_py) and \
os.stat(infile).st_mode & stat.S_IEXEC:
# Adjust interpreter of OpenVPN hooks.
with open(infile) as src:
first_line = src.readline()
m = first_line_re.match(first_line)
if m and not self.dry_run:
log.info("copying and adjusting %s -> %s", infile, outfile)
executable = self.distribution.command_obj['build'].executable
with open(outfile, "wb") as dst:
dst.write("#!%s%s\n" % (executable, m.group(1) or ''))
dst.write(src.read())
return outfile, 1
cls, = self.__class__.__bases__ cls, = self.__class__.__bases__
return cls.copy_file(self, infile, outfile, *args, **kw) return cls.copy_file(self, infile, outfile, *args, **kw)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment