-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathwtfnmfgen.py
executable file
·209 lines (172 loc) · 5.84 KB
/
wtfnmfgen.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
##
# Copyright (C) Ben McGinnes, 2014-2016
# Copyright © Ben McGinnes, 2014-2016
#
# OpenPGP/GPG key: 0x321E4E2373590E5D
#
# Version: 0.2.0
#
# License: WTFNMFPLv1
#
# https://github.com/adversary-org/wtfnmf
#
# Requirements:
#
# * Python 3.2 or later.
# * Should work with Python 2.7, but not guaranteed.
#
# Options and notes:
#
# Adapted from my BSD license generator.
#
# Usage:
#
# wtfnmfgen.py YYYY Danger Mouse
#
# or
#
# wtfnmfgen.py YYYY "Danger Mouse <[email protected]>"
#
##
__author__ = "Ben McGinnes <[email protected]>"
__copyright__ = "Copyright © Benjamin D. McGinnes, 2014-2016"
__copyrighta__ = "Copyright (C) Benjamin D. McGinnes, 2014-2016"
__license__ = "WTFNMFPLv1"
__version__ = "0.2.0"
from datetime import datetime
import sys
print("""
If entering both options (start year and name) on the command line
then the year must be the first option and the name second.
Entering the name in quotation marks is optional unless an email
address is included with the copyright line. If including an
email address using "<" and ">" then the quotation marks are
required to prevent the shell from using those to direct input or
output somewhere.".
Two text files containing the license are created, one in plain
text and the other in Unicode (UTF-8).
""")
l = len(sys.argv)
if l == 1:
year1 = input("Enter the year to begin copyright from: ")
name = input("Enter your name as you want it to appear on the copyright: ")
elif l == 2:
year1 = sys.argv[1]
name = input("Enter your name as you want it to appear on the copyright: ")
elif l == 3:
year1 = sys.argv[1]
name = sys.argv[2]
elif l >= 4:
year1 = sys.argv[1]
name = " ".join(sys.argv[2:])
year2 = str(datetime.now().year)
if year1 == year2:
year3 = year2
else:
year3 = year1+"-"+year2
txta = "Copyright (C) {0}, {1}".format(name, year3)
texta = "Copyright (C) {0} {1}".format(year3, name)
txtu = "Copyright © {0}, {1}".format(name, year3)
textu = "Copyright © {0} {1}".format(year3, name)
boilera1 = """
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To But It's Not My Fault Public
License, Version 1, as published by Ben McGinnes. See the
COPYING.WTFNMFPLv1a.txt file for more details.
"""
boilera2 = """
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To But It's Not My Fault Public
License, Version 1, as published by Ben McGinnes. See the
COPYING.WTFNMFPLv1a.text file for more details.
"""
ltexta = """
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To But It's Not My Fault Public
License, Version 1, as published by Ben McGinnes:
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE
Version 1, October 2013
Copyright (C) 2013 Ben McGinnes <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
1. Do not hold the author(s), creator(s), developer(s) or
distributor(s) liable for anything that happens or goes wrong
with your use of the work.
"""
boileru1 = """
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To But It's Not My Fault Public
License, Version 1, as published by Ben McGinnes. See the
COPYING.WTFNMFPLv1u.txt file for more details.
"""
boileru2 = """
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To But It's Not My Fault Public
License, Version 1, as published by Ben McGinnes. See the
COPYING.WTFNMFPLv1u.text file for more details.
"""
ltextu = """
This work is free. You can redistribute it and/or modify it under the
terms of the Do What The Fuck You Want To But It's Not My Fault Public
License, Version 1, as published by Ben McGinnes:
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE
Version 1, October 2013
Copyright © 2013 Ben McGinnes <[email protected]>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO BUT IT'S NOT MY FAULT PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.
1. Do not hold the author(s), creator(s), developer(s) or
distributor(s) liable for anything that happens or goes wrong
with your use of the work.
"""
a1file = open("COPYING.WTFNMFPLv1a.txt", "w")
a1file.write(txta)
a1file.write("\n")
a1file.write(ltexta)
a1file.close()
b1file = open("ascii_boilerplate.txt", "w")
b1file.write(txta)
b1file.write("\n")
b1file.write(boilera1)
b1file.close()
u1file = open("COPYING.WTFNMFPLv1u.txt", "w")
u1file.write(txtu)
u1file.write("\n")
u1file.write(ltextu)
u1file.close()
v1file = open("utf8_boilerplate.txt", "w")
v1file.write(txtu)
v1file.write("\n")
v1file.write(boileru1)
v1file.close()
a2file = open("COPYING.WTFNMFPLv1a.text", "w")
a2file.write(texta)
a2file.write("\n")
a2file.write(ltexta)
a2file.close()
b2file = open("ascii_boilerplate.text", "w")
b2file.write(texta)
b2file.write("\n")
b2file.write(boilera2)
b2file.close()
u2file = open("COPYING.WTFNMFPLv1u.text", "w")
u2file.write(textu)
u2file.write("\n")
u2file.write(ltextu)
u2file.close()
v2file = open("utf8_boilerplate.text", "w")
v2file.write(textu)
v2file.write("\n")
v2file.write(boileru2)
v2file.close()