Codebase list osrframework / ee9ae37
Refresh patches and add a patch to use bs4 Sophie Brun 5 years ago
7 changed file(s) with 40 addition(s) and 200 deletion(s). Raw diff Collapse all Expand all
99 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
1010 --- a/setup.py
1111 +++ b/setup.py
12 @@ -31,67 +31,67 @@ import site
13 IS_VIRTUAL_ENV = False
14
15 # Get packagesPaths depending on whether the user launched it with sudo or not
16 -if sys.platform == 'win32':
17 +#if sys.platform == 'win32':
18 # This will throw two folders, but we need the first one only. Typically:
19 # ['c:\\Users\\<a_user>\\AppData\\Roaming\\Python\\Python27\\site-packages']
20 - packagesPaths = site.getusersitepackages()[0]
21 - print "[*] The installation is going to be run as superuser."
22 -else:
23 +# packagesPaths = site.getusersitepackages()[0]
24 +# print "[*] The installation is going to be run as superuser."
25 +#else:
26 # We need this verification because Windows does not have a wrapper ofr os.geteuid()
27 - if not os.geteuid() == 0:
28 - try:
29 - packagesPaths = site.getusersitepackages()
30 +# if not os.geteuid() == 0:
31 +# try:
32 +# packagesPaths = site.getusersitepackages()
33 # TODO: Check whether the packagesPaths is in the PATH, if not, add it
34 - print "[*] The installation has not been launched as superuser."
35 - user_bin_path = site.USER_BASE + "/bin"
36 - print "[*] We will verify is the '" + user_bin_path + "' folder is in the path so as to make the utils available anywhere in the system."
37 - bin_path = os.popen("echo $PATH").read()
38 - if user_bin_path in bin_path:
39 - print "[*] Great. '" + user_bin_path + "' is in the path. No further actions needed."
40 - else:
41 - print "[*] We are manually adding the '" + user_bin_path + "' folder to the ~/.bashrc file."
42 +# print "[*] The installation has not been launched as superuser."
43 +# user_bin_path = site.USER_BASE + "/bin"
44 +# print "[*] We will verify is the '" + user_bin_path + "' folder is in the path so as to make the utils available anywhere in the system."
45 +# bin_path = os.popen("echo $PATH").read()
46 +# if user_bin_path in bin_path:
47 +# print "[*] Great. '" + user_bin_path + "' is in the path. No further actions needed."
48 +# else:
49 +# print "[*] We are manually adding the '" + user_bin_path + "' folder to the ~/.bashrc file."
50 # Building the commands to be added to .bashrc
51 - new_lines = """
52 +# new_lines = """
53 # Added by OSRFramework
54 # ---------------------
55 # Check this issue in Github for additional information about why these lines where added: <https://github.com/i3visio/osrframework/issues/187>
56
57 - export PY_USER_BIN= """ + user_bin_path + """
58 - export PATH=$PATH:$PY_USER_BIN
59 - """
60 -
61 - command = "echo '''" + new_lines + "''' >> ~/.bashrc"
62 - print "[*] As we want to be transparent, the command that is being run is the following:\n" + command
63 - a = os.popen(command).read()
64 - except:
65 - IS_VIRTUAL_ENV = True
66 - else:
67 +# export PY_USER_BIN= """ + user_bin_path + """
68 +# export PATH=$PATH:$PY_USER_BIN
69 +# """
70 +
71 +# command = "echo '''" + new_lines + "''' >> ~/.bashrc"
72 +# print "[*] As we want to be transparent, the command that is being run is the following:\n" + command
73 +# a = os.popen(command).read()
74 +# except:
75 +# IS_VIRTUAL_ENV = True
76 +# else:
77 # This will throw two folders, but we need the first one only:
78 # ['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
79 - packagesPaths = site.getsitepackages()[0]
80 - print "[*] The installation is going to be run as superuser."
81 +# packagesPaths = site.getsitepackages()[0]
82 +# print "[*] The installation is going to be run as superuser."
83
84 -if not IS_VIRTUAL_ENV:
85 - osrframeworkSystemPath = os.path.join(packagesPaths, "osrframework")
86 +#if not IS_VIRTUAL_ENV:
87 +# osrframeworkSystemPath = os.path.join(packagesPaths, "osrframework")
88
89 - print "[*] The chosen installation path is: " + osrframeworkSystemPath
90 +# print "[*] The chosen installation path is: " + osrframeworkSystemPath
91
92 # Removing old installations first...
93 - if os.path.isdir(osrframeworkSystemPath):
94 - print "[!] Found an old installation at: " + osrframeworkSystemPath
95 - try:
96 - shutil.rmtree(osrframeworkSystemPath)
97 - print "[*] Successfully removed the old installation. Installation will resume now to upgrade it..."
98 - except Exception as e:
99 - print str(e)
100 - print "[E] The installed version of OSRFramework cannot be removed. Try to remove it manually in your python installation under 'local/lib/python2.7/dist-packages/'."
101 - print sys.exit()
102 - else:
103 - print "[*] No OSRFramework installation found in the system."
104 -else:
105 - print "[*] OSRFramework seems to be installed using `virtualenv`."
106 +# if os.path.isdir(osrframeworkSystemPath):
107 +# print "[!] Found an old installation at: " + osrframeworkSystemPath
108 +# try:
109 +# shutil.rmtree(osrframeworkSystemPath)
110 +# print "[*] Successfully removed the old installation. Installation will resume now to upgrade it..."
111 +# except Exception as e:
112 +# print str(e)
113 +# print "[E] The installed version of OSRFramework cannot be removed. Try to remove it manually in your python installation under 'local/lib/python2.7/dist-packages/'."
114 +# print sys.exit()
115 +# else:
116 +# print "[*] No OSRFramework installation found in the system."
117 +#else:
118 +# print "[*] OSRFramework seems to be installed using `virtualenv`."
119
120 -HERE = os.path.abspath(os.path.dirname(__file__))
121 +#HERE = os.path.abspath(os.path.dirname(__file__))
122
123 # Importing the temporal scripts for the setup and taking the new version number
124 import osrframework
125 @@ -100,15 +100,15 @@ NEW_VERSION = osrframework.__version__
12 @@ -37,15 +37,15 @@ NEW_VERSION = osrframework.__version__
12613 import osrframework.utils.configuration as configuration
12714
12815 # Depending on the place in which the project is going to be upgraded
14734
14835 # Reading the .md file
14936 try:
150 @@ -206,49 +206,49 @@ setup(
37 @@ -149,49 +149,49 @@ setup(
15138 ############################
15239 ### Creating other files ###
15340 ############################
154 -print "[*] Changing permissions of the user folders..."
41 -print("[*] Changing permissions of the user folders...")
15542 -try:
15643 - configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
15744 -except:
158 +#print "[*] Changing permissions of the user folders..."
45 +#print("[*] Changing permissions of the user folders...")
15946 +#try:
16047 +# configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID')))
16148 +#except:
16350 - pass
16451 +# pass
16552
166 -print "[*] Copying relevant files..."
53 -print("[*] Copying relevant files...")
16754 -files_to_copy= {
16855 - paths["appPath"] : [
16956 - os.path.join("config", "browser.cfg"),
18269 - os.path.join("config", "plugins", "pattern.py.sample"),
18370 - ]
18471 -}
185 +#print "[*] Copying relevant files..."
72 +#print("[*] Copying relevant files...")
18673 +#files_to_copy= {
18774 +# paths["appPath"] : [
18875 +# os.path.join("config", "browser.cfg"),
20491
20592 # Iterating through all destinations to write the info
20693 -for destiny in files_to_copy.keys():
207 +#for destiny in files_to_copy.keys():
208 # Grabbing each source file to be moved
94 - # Grabbing each source file to be moved
20995 - for sourceFile in files_to_copy[destiny]:
21096 - fileToMove = os.path.join(HERE,sourceFile)
211 +# for sourceFile in files_to_copy[destiny]:
212 +# fileToMove = os.path.join(HERE,sourceFile)
213
214 # Choosing the command depending on the SO
97 -
98 - cmd = ""
99 - # Choosing the command depending on the SO
215100 - if sys.platform == 'win32':
216101 - if os.path.isdir(fileToMove):
217102 - cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e"
222107 - cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
223108 - else:
224109 - cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
110 - output = os.popen(cmd).read()
111 +#for destiny in files_to_copy.keys():
112 +# # Grabbing each source file to be moved
113 +# for sourceFile in files_to_copy[destiny]:
114 +# fileToMove = os.path.join(HERE,sourceFile)
115 +#
116 +# cmd = ""
117 +# # Choosing the command depending on the SO
225118 +# if sys.platform == 'win32':
226119 +# if os.path.isdir(fileToMove):
227120 +# cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e"
232125 +# cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
233126 +# else:
234127 +# cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\""
235 #print cmd
236 - output = os.popen(cmd).read()
237128 +# output = os.popen(cmd).read()
1818 import osrframework.thirdparties.haveibeenpwned_com.hibp as hibp
1919 --- a/setup.py
2020 +++ b/setup.py
21 @@ -184,7 +184,7 @@ setup(
21 @@ -125,7 +125,7 @@ setup(
2222 "tweepy",
2323 "networkx",
2424 "decorator",
66 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
77 --- a/setup.py
88 +++ b/setup.py
9 @@ -189,7 +189,7 @@ setup(
9 @@ -130,7 +130,7 @@ setup(
1010 "tabulate",
1111 "oauthlib>=1.0.0",
1212 # Added to dinamically import wrappers:
+0
-69
debian/patches/fix-alias-generator.patch less more
0 From 8139090d5d9b16cbbecfec65900c7a17e93ba228 Mon Sep 17 00:00:00 2001
1 From: i3visio <[email protected]>
2 Date: Sun, 4 Feb 2018 14:59:17 +0100
3 Subject: [PATCH] Fix #302: alias_generator fails with main
4
5 The alias_generator.py launcher was not working properly because
6 the main function has been redefined twice. This has been fixed
7 by renaming the traditional `main` to `generate`. At the same
8 time, the list of nicks generated is only sent to a file if called
9 by main.
10 ---
11 osrframework/alias_generator.py | 21 ++++++++++++---------
12 1 file changed, 12 insertions(+), 9 deletions(-)
13
14 diff --git a/osrframework/alias_generator.py b/osrframework/alias_generator.py
15 index f86aa83..712e72f 100644
16 --- a/osrframework/alias_generator.py
17 +++ b/osrframework/alias_generator.py
18 @@ -45,11 +45,12 @@
19 }
20
21
22 -def main(name=None, surname1=None, surname2=None, city=None, country=None, year=None, useNumbers=False, useCommonWords=False, useLeet=False, useLocales=False, extraWords=[]):
23 +def generate(name=None, surname1=None, surname2=None, city=None, country=None, year=None, useNumbers=False, useCommonWords=False, useLeet=False, useLocales=False, extraWords=[]):
24 """
25 - The main method that generates the given aliases.
26 + The method that generates the given aliases.
27
28 It receives several parameters as parsed by this module's `getParser()`.
29 + Previously referenced as `main`.
30
31 Args:
32 -----
33 @@ -2808,12 +2809,6 @@ def main(name=None, surname1=None, surname2=None, city=None, country=None, year=
34 print("\nGenerated nicks:\n")
35 print(general.success(json.dumps(listaFinal, indent=2, sort_keys=True)))
36 print("\nUp to " + general.emphasis(str(len(listaFinal))) + " nicks generated.\n")
37 - print("Writing the results onto the file:\n\t" + general.emphasis(args.outputFile))
38 -
39 - oF=open(args.outputFile, "w")
40 - for l in listaFinal:
41 - oF.write(l+"\n")
42 - oF.close()
43
44 return listaFinal
45
46 @@ -2901,7 +2896,7 @@ def main(params=None):
47 if args.country != "":
48 print("Country: ".ljust(20, " ") + args.country)
49
50 - main(
51 + aliases = generate(
52 name=args.name,
53 surname1=args.surname1,
54 surname2=args.surname2,
55 @@ -2915,6 +2910,14 @@ def main(params=None):
56 extraWords=extraWords
57 )
58
59 + print("Writing the results onto the file:\n\t" + general.emphasis(args.outputFile))
60 +
61 + oF=open(args.outputFile, "w")
62 + for l in aliases:
63 + oF.write(l+"\n")
64 + oF.close()
65 +
66 +
67 # Urging users to place an issue on Github...
68 print(banner.footer)
0 use-bs4-by-default.patch
01 cleanup-setup.patch
12 dont-use-validate-email.patch
23 drop-explicit-need-of-importlib.patch
34 upgrade-installation.patch
45 initalize-config.patch
56 add-script-config-upgrade.patch
6 fix-alias-generator.patch
1717 from setuptools import setup, find_packages
1818 import shutil
1919 import site
20 @@ -168,6 +169,11 @@ setup(
20 @@ -109,6 +110,11 @@ setup(
2121 'Topic :: Text Processing :: Markup :: HTML'
2222 ],
2323 packages=find_packages(),
0 Description: Use bs4 by default
1 Mention beautifulsoup4 in setup so that pybuild generates a dependency on
2 bs4 and not on obsolete beautifulsoup
3 Author: Sophie Brun <[email protected]>
4 Last-Update: 2018-10-18
5 ---
6 This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
7 --- a/setup.py
8 +++ b/setup.py
9 @@ -115,7 +115,7 @@ setup(
10 "mechanize",
11 "requests",
12 "python-emailahoy",
13 - "BeautifulSoup",
14 + "beautifulsoup4",
15 "pyexcel==0.2.1",
16 "pyexcel_ods==0.1.1",
17 "pyexcel_xls==0.1.0",