Setup.py updates
- only waits for a prompt if running from a TTY - support for Ubuntu 12 and older (different msgpack package name) - fix crash for missing keys in the distro definition - accept alternative msgpack providers - add pyopencl as an extra
This commit is contained in:
parent
0529fe2313
commit
13223887fc
28
setup.py
28
setup.py
|
@ -17,6 +17,7 @@ packageManager = {
|
||||||
"FreeBSD": "pkg install",
|
"FreeBSD": "pkg install",
|
||||||
"Debian": "apt-get install",
|
"Debian": "apt-get install",
|
||||||
"Ubuntu": "apt-get install",
|
"Ubuntu": "apt-get install",
|
||||||
|
"Ubuntu 12": "apt-get install",
|
||||||
"openSUSE": "zypper install",
|
"openSUSE": "zypper install",
|
||||||
"Fedora": "dnf install",
|
"Fedora": "dnf install",
|
||||||
"Guix": "guix package -i",
|
"Guix": "guix package -i",
|
||||||
|
@ -29,6 +30,7 @@ packageName = {
|
||||||
"FreeBSD": "py27-qt4",
|
"FreeBSD": "py27-qt4",
|
||||||
"Debian": "python-qt4",
|
"Debian": "python-qt4",
|
||||||
"Ubuntu": "python-qt4",
|
"Ubuntu": "python-qt4",
|
||||||
|
"Ubuntu 12": "python-qt4",
|
||||||
"openSUSE": "python-qt",
|
"openSUSE": "python-qt",
|
||||||
"Fedora": "PyQt4",
|
"Fedora": "PyQt4",
|
||||||
"Guix": "python2-pyqt@4.11.4",
|
"Guix": "python2-pyqt@4.11.4",
|
||||||
|
@ -44,6 +46,7 @@ packageName = {
|
||||||
"FreeBSD": "py27-msgpack-python",
|
"FreeBSD": "py27-msgpack-python",
|
||||||
"Debian": "python-msgpack",
|
"Debian": "python-msgpack",
|
||||||
"Ubuntu": "python-msgpack",
|
"Ubuntu": "python-msgpack",
|
||||||
|
"Ubuntu 12": "msgpack-python",
|
||||||
"openSUSE": "python-msgpack-python",
|
"openSUSE": "python-msgpack-python",
|
||||||
"Fedora": "python2-msgpack",
|
"Fedora": "python2-msgpack",
|
||||||
"Guix": "python2-msgpack",
|
"Guix": "python2-msgpack",
|
||||||
|
@ -53,6 +56,7 @@ packageName = {
|
||||||
"FreeBSD": "py27-pyopencl",
|
"FreeBSD": "py27-pyopencl",
|
||||||
"Debian": "python-pyopencl",
|
"Debian": "python-pyopencl",
|
||||||
"Ubuntu": "python-pyopencl",
|
"Ubuntu": "python-pyopencl",
|
||||||
|
"Ubuntu 12": "python-pyopencl",
|
||||||
"Fedora": "python2-pyopencl",
|
"Fedora": "python2-pyopencl",
|
||||||
"openSUSE": "",
|
"openSUSE": "",
|
||||||
"OpenBSD": "",
|
"OpenBSD": "",
|
||||||
|
@ -68,6 +72,7 @@ packageName = {
|
||||||
"FreeBSD": "py27-setuptools",
|
"FreeBSD": "py27-setuptools",
|
||||||
"Debian": "python-setuptools",
|
"Debian": "python-setuptools",
|
||||||
"Ubuntu": "python-setuptools",
|
"Ubuntu": "python-setuptools",
|
||||||
|
"Ubuntu 12": "python-setuptools",
|
||||||
"Fedora": "python2-setuptools",
|
"Fedora": "python2-setuptools",
|
||||||
"openSUSE": "python-setuptools",
|
"openSUSE": "python-setuptools",
|
||||||
"Guix": "python2-setuptools",
|
"Guix": "python2-setuptools",
|
||||||
|
@ -94,6 +99,7 @@ def detectOS():
|
||||||
detectOS.result = "Windows"
|
detectOS.result = "Windows"
|
||||||
elif os.path.isfile("/etc/os-release"):
|
elif os.path.isfile("/etc/os-release"):
|
||||||
with open("/etc/os-release", 'rt') as osRelease:
|
with open("/etc/os-release", 'rt') as osRelease:
|
||||||
|
version = None
|
||||||
for line in osRelease:
|
for line in osRelease:
|
||||||
if line.startswith("NAME="):
|
if line.startswith("NAME="):
|
||||||
line = line.lower()
|
line = line.lower()
|
||||||
|
@ -109,6 +115,13 @@ def detectOS():
|
||||||
detectOS.result = "Gentoo"
|
detectOS.result = "Gentoo"
|
||||||
else:
|
else:
|
||||||
detectOS.result = None
|
detectOS.result = None
|
||||||
|
if line.startswith("VERSION_ID="):
|
||||||
|
try:
|
||||||
|
version = float(line.split("\"")[1])
|
||||||
|
except ValueError:
|
||||||
|
pass
|
||||||
|
if detectOS.result == "Ubuntu" and version < 14:
|
||||||
|
detectOS.result = "Ubuntu 12"
|
||||||
elif os.path.isfile("/etc/config.scm"):
|
elif os.path.isfile("/etc/config.scm"):
|
||||||
detectOS.result = "Guix"
|
detectOS.result = "Guix"
|
||||||
return detectOS.result
|
return detectOS.result
|
||||||
|
@ -133,8 +146,11 @@ def prereqToPackages():
|
||||||
packageManager[detectOS()], " ".join(
|
packageManager[detectOS()], " ".join(
|
||||||
packageName[x][detectOS()] for x in detectPrereqs(True)))
|
packageName[x][detectOS()] for x in detectPrereqs(True)))
|
||||||
for package in detectPrereqs(True):
|
for package in detectPrereqs(True):
|
||||||
|
try:
|
||||||
if packageName[package]['optional']:
|
if packageName[package]['optional']:
|
||||||
print packageName[package]['description']
|
print packageName[package]['description']
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def compilerToPackages():
|
def compilerToPackages():
|
||||||
if not detectOS() in compiling:
|
if not detectOS() in compiling:
|
||||||
|
@ -159,7 +175,7 @@ if __name__ == "__main__":
|
||||||
print "It looks like you're missing setuptools."
|
print "It looks like you're missing setuptools."
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
if detectPrereqs(True) != []:
|
if detectPrereqs(True) != [] and sys.stdin.isatty():
|
||||||
print "Press Return to continue"
|
print "Press Return to continue"
|
||||||
try:
|
try:
|
||||||
nothing = raw_input()
|
nothing = raw_input()
|
||||||
|
@ -176,6 +192,11 @@ if __name__ == "__main__":
|
||||||
libraries=['pthread', 'crypto'],
|
libraries=['pthread', 'crypto'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
installRequires = []
|
||||||
|
# this will silently accept alternative providers of msgpack if they are already installed
|
||||||
|
if "msgpack" in detectPrereqs(True):
|
||||||
|
installRequires.append("msgpack-python")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dist = setup(
|
dist = setup(
|
||||||
name='pybitmessage',
|
name='pybitmessage',
|
||||||
|
@ -190,9 +211,10 @@ if __name__ == "__main__":
|
||||||
url='https://bitmessage.org',
|
url='https://bitmessage.org',
|
||||||
# TODO: add keywords
|
# TODO: add keywords
|
||||||
#keywords='',
|
#keywords='',
|
||||||
install_requires=['msgpack-python'],
|
install_requires=[installRequires],
|
||||||
extras_require={
|
extras_require={
|
||||||
'qrcode': ['qrcode']
|
'qrcode': ['qrcode'],
|
||||||
|
'pyopencl': ['pyopencl']
|
||||||
},
|
},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"License :: OSI Approved :: MIT License"
|
"License :: OSI Approved :: MIT License"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user