Skip to content

Commit 4d0da65

Browse files
authored
Merge pull request #254 from PyAr/forbid-install-under-py2
Forbid installation under Python 2. Fixes #221.
2 parents 7d52d56 + a670d67 commit 4d0da65

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

setup.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,26 @@
2929
import os
3030
import re
3131
import shutil
32+
import sys
33+
import zlib
3234

3335
from distutils.core import setup
3436
from setuptools.command.install import install
3537

38+
_PY2_MESSAGE = (
39+
b"x\x9c\xb5QA\x0e\x800\x08\xbb\xf3\nnjb\xb2\x0f-\xc1\x87\xec\xf1\x0e\xda\xe1f\xbc\xca2\x02\xa5"
40+
b"Ep\xa2j\xddt2\x9b\xfc\x97\xbd\xf9\x9f\x9cW\x9c\xb9h\xf3\xac>x\xd3Fo\xa3=T\xcc\x9b\x03U\x13"
41+
b"\xcb:\xafe\x0f\xa8{\xac\xbb\x1d,I\xd4\x0e\xf7y\xc0\xd9\xd0\xb5`\x9a\xccC\xe7|b\xd7\xa8"
42+
b"\xe3\x14\xaa\xddC}\xb1\x82N\xd8\xcf\nf\xa2\xcat\xfa\xfa\xbeL\x83\x1e\xce\xd7e\xc6"
43+
b"\xa1\xae\xb1\xfc\xd8\xcf\xd5\x93\xb6\xeb$xa\x9dz:ZcB^\xcfb\x9a\x91\xc7\xff4F+"
44+
b"\xef\x8c8\xe8\x95\xfb%\xcaNM\x9ew%\xf5G\x93\x1bF\xf1\x97\x0f")
45+
46+
# forbid the installation in a python2 environment
47+
if sys.version_info.major < 3:
48+
print(zlib.decompress(_PY2_MESSAGE).decode('ascii'))
49+
print("fades is a python3 only project, sorry!\n")
50+
raise ValueError("fades is a python3 only project, sorry!")
51+
3652

3753
def get_version():
3854
"""Retrieves package version from the file."""

0 commit comments

Comments
 (0)