diff --git a/debian/patches/cleanup-setup.patch b/debian/patches/cleanup-setup.patch index 6f9b819..36ad824 100644 --- a/debian/patches/cleanup-setup.patch +++ b/debian/patches/cleanup-setup.patch @@ -10,120 +10,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/setup.py +++ b/setup.py -@@ -31,67 +31,67 @@ import site - IS_VIRTUAL_ENV = False - - # Get packagesPaths depending on whether the user launched it with sudo or not --if sys.platform == 'win32': -+#if sys.platform == 'win32': - # This will throw two folders, but we need the first one only. Typically: - # ['c:\\Users\\\\AppData\\Roaming\\Python\\Python27\\site-packages'] -- packagesPaths = site.getusersitepackages()[0] -- print "[*] The installation is going to be run as superuser." --else: -+# packagesPaths = site.getusersitepackages()[0] -+# print "[*] The installation is going to be run as superuser." -+#else: - # We need this verification because Windows does not have a wrapper ofr os.geteuid() -- if not os.geteuid() == 0: -- try: -- packagesPaths = site.getusersitepackages() -+# if not os.geteuid() == 0: -+# try: -+# packagesPaths = site.getusersitepackages() - # TODO: Check whether the packagesPaths is in the PATH, if not, add it -- print "[*] The installation has not been launched as superuser." -- user_bin_path = site.USER_BASE + "/bin" -- 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." -- bin_path = os.popen("echo $PATH").read() -- if user_bin_path in bin_path: -- print "[*] Great. '" + user_bin_path + "' is in the path. No further actions needed." -- else: -- print "[*] We are manually adding the '" + user_bin_path + "' folder to the ~/.bashrc file." -+# print "[*] The installation has not been launched as superuser." -+# user_bin_path = site.USER_BASE + "/bin" -+# 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." -+# bin_path = os.popen("echo $PATH").read() -+# if user_bin_path in bin_path: -+# print "[*] Great. '" + user_bin_path + "' is in the path. No further actions needed." -+# else: -+# print "[*] We are manually adding the '" + user_bin_path + "' folder to the ~/.bashrc file." - # Building the commands to be added to .bashrc -- new_lines = """ -+# new_lines = """ - # Added by OSRFramework - # --------------------- - # Check this issue in Github for additional information about why these lines where added: - -- export PY_USER_BIN= """ + user_bin_path + """ -- export PATH=$PATH:$PY_USER_BIN -- """ -- -- command = "echo '''" + new_lines + "''' >> ~/.bashrc" -- print "[*] As we want to be transparent, the command that is being run is the following:\n" + command -- a = os.popen(command).read() -- except: -- IS_VIRTUAL_ENV = True -- else: -+# export PY_USER_BIN= """ + user_bin_path + """ -+# export PATH=$PATH:$PY_USER_BIN -+# """ -+ -+# command = "echo '''" + new_lines + "''' >> ~/.bashrc" -+# print "[*] As we want to be transparent, the command that is being run is the following:\n" + command -+# a = os.popen(command).read() -+# except: -+# IS_VIRTUAL_ENV = True -+# else: - # This will throw two folders, but we need the first one only: - # ['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages'] -- packagesPaths = site.getsitepackages()[0] -- print "[*] The installation is going to be run as superuser." -+# packagesPaths = site.getsitepackages()[0] -+# print "[*] The installation is going to be run as superuser." - --if not IS_VIRTUAL_ENV: -- osrframeworkSystemPath = os.path.join(packagesPaths, "osrframework") -+#if not IS_VIRTUAL_ENV: -+# osrframeworkSystemPath = os.path.join(packagesPaths, "osrframework") - -- print "[*] The chosen installation path is: " + osrframeworkSystemPath -+# print "[*] The chosen installation path is: " + osrframeworkSystemPath - - # Removing old installations first... -- if os.path.isdir(osrframeworkSystemPath): -- print "[!] Found an old installation at: " + osrframeworkSystemPath -- try: -- shutil.rmtree(osrframeworkSystemPath) -- print "[*] Successfully removed the old installation. Installation will resume now to upgrade it..." -- except Exception as e: -- print str(e) -- 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/'." -- print sys.exit() -- else: -- print "[*] No OSRFramework installation found in the system." --else: -- print "[*] OSRFramework seems to be installed using `virtualenv`." -+# if os.path.isdir(osrframeworkSystemPath): -+# print "[!] Found an old installation at: " + osrframeworkSystemPath -+# try: -+# shutil.rmtree(osrframeworkSystemPath) -+# print "[*] Successfully removed the old installation. Installation will resume now to upgrade it..." -+# except Exception as e: -+# print str(e) -+# 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/'." -+# print sys.exit() -+# else: -+# print "[*] No OSRFramework installation found in the system." -+#else: -+# print "[*] OSRFramework seems to be installed using `virtualenv`." - --HERE = os.path.abspath(os.path.dirname(__file__)) -+#HERE = os.path.abspath(os.path.dirname(__file__)) - - # Importing the temporal scripts for the setup and taking the new version number - import osrframework -@@ -100,15 +100,15 @@ NEW_VERSION = osrframework.__version__ +@@ -37,15 +37,15 @@ NEW_VERSION = osrframework.__version__ import osrframework.utils.configuration as configuration # Depending on the place in which the project is going to be upgraded @@ -148,15 +35,15 @@ # Reading the .md file try: -@@ -206,49 +206,49 @@ setup( +@@ -149,49 +149,49 @@ setup( ############################ ### Creating other files ### ############################ --print "[*] Changing permissions of the user folders..." +-print("[*] Changing permissions of the user folders...") -try: - configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID'))) -except: -+#print "[*] Changing permissions of the user folders..." ++#print("[*] Changing permissions of the user folders...") +#try: +# configuration.changePermissionsRecursively(paths["appPath"], int(os.getenv('SUDO_UID')), int(os.getenv('SUDO_GID'))) +#except: @@ -164,7 +51,7 @@ - pass +# pass --print "[*] Copying relevant files..." +-print("[*] Copying relevant files...") -files_to_copy= { - paths["appPath"] : [ - os.path.join("config", "browser.cfg"), @@ -183,7 +70,7 @@ - os.path.join("config", "plugins", "pattern.py.sample"), - ] -} -+#print "[*] Copying relevant files..." ++#print("[*] Copying relevant files...") +#files_to_copy= { +# paths["appPath"] : [ +# os.path.join("config", "browser.cfg"), @@ -205,14 +92,12 @@ # Iterating through all destinations to write the info -for destiny in files_to_copy.keys(): -+#for destiny in files_to_copy.keys(): - # Grabbing each source file to be moved +- # Grabbing each source file to be moved - for sourceFile in files_to_copy[destiny]: - fileToMove = os.path.join(HERE,sourceFile) -+# for sourceFile in files_to_copy[destiny]: -+# fileToMove = os.path.join(HERE,sourceFile) - - # Choosing the command depending on the SO +- +- cmd = "" +- # Choosing the command depending on the SO - if sys.platform == 'win32': - if os.path.isdir(fileToMove): - cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e" @@ -223,6 +108,14 @@ - cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\"" - else: - cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\"" +- output = os.popen(cmd).read() ++#for destiny in files_to_copy.keys(): ++# # Grabbing each source file to be moved ++# for sourceFile in files_to_copy[destiny]: ++# fileToMove = os.path.join(HERE,sourceFile) ++# ++# cmd = "" ++# # Choosing the command depending on the SO +# if sys.platform == 'win32': +# if os.path.isdir(fileToMove): +# cmd = "echo d | xcopy \"" + fileToMove + "\" \"" + destiny + "\" /s /e" @@ -233,6 +126,4 @@ +# cmd = "cp -r -- \"" + fileToMove + "\" \"" + destiny + "\"" +# else: +# cmd = "sudo cp -r -- \"" + fileToMove + "\" \"" + destiny + "\"" - #print cmd -- output = os.popen(cmd).read() +# output = os.popen(cmd).read() diff --git a/debian/patches/dont-use-validate-email.patch b/debian/patches/dont-use-validate-email.patch index 242882b..51013eb 100644 --- a/debian/patches/dont-use-validate-email.patch +++ b/debian/patches/dont-use-validate-email.patch @@ -19,7 +19,7 @@ import osrframework.thirdparties.haveibeenpwned_com.hibp as hibp --- a/setup.py +++ b/setup.py -@@ -184,7 +184,7 @@ setup( +@@ -125,7 +125,7 @@ setup( "tweepy", "networkx", "decorator", diff --git a/debian/patches/drop-explicit-need-of-importlib.patch b/debian/patches/drop-explicit-need-of-importlib.patch index 6abe1eb..fb1203e 100644 --- a/debian/patches/drop-explicit-need-of-importlib.patch +++ b/debian/patches/drop-explicit-need-of-importlib.patch @@ -7,7 +7,7 @@ This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ --- a/setup.py +++ b/setup.py -@@ -189,7 +189,7 @@ setup( +@@ -130,7 +130,7 @@ setup( "tabulate", "oauthlib>=1.0.0", # Added to dinamically import wrappers: diff --git a/debian/patches/fix-alias-generator.patch b/debian/patches/fix-alias-generator.patch deleted file mode 100644 index c8633a7..0000000 --- a/debian/patches/fix-alias-generator.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 8139090d5d9b16cbbecfec65900c7a17e93ba228 Mon Sep 17 00:00:00 2001 -From: i3visio -Date: Sun, 4 Feb 2018 14:59:17 +0100 -Subject: [PATCH] Fix #302: alias_generator fails with main - -The alias_generator.py launcher was not working properly because -the main function has been redefined twice. This has been fixed -by renaming the traditional `main` to `generate`. At the same -time, the list of nicks generated is only sent to a file if called -by main. ---- - osrframework/alias_generator.py | 21 ++++++++++++--------- - 1 file changed, 12 insertions(+), 9 deletions(-) - -diff --git a/osrframework/alias_generator.py b/osrframework/alias_generator.py -index f86aa83..712e72f 100644 ---- a/osrframework/alias_generator.py -+++ b/osrframework/alias_generator.py -@@ -45,11 +45,12 @@ - } - - --def main(name=None, surname1=None, surname2=None, city=None, country=None, year=None, useNumbers=False, useCommonWords=False, useLeet=False, useLocales=False, extraWords=[]): -+def generate(name=None, surname1=None, surname2=None, city=None, country=None, year=None, useNumbers=False, useCommonWords=False, useLeet=False, useLocales=False, extraWords=[]): - """ -- The main method that generates the given aliases. -+ The method that generates the given aliases. - - It receives several parameters as parsed by this module's `getParser()`. -+ Previously referenced as `main`. - - Args: - ----- -@@ -2808,12 +2809,6 @@ def main(name=None, surname1=None, surname2=None, city=None, country=None, year= - print("\nGenerated nicks:\n") - print(general.success(json.dumps(listaFinal, indent=2, sort_keys=True))) - print("\nUp to " + general.emphasis(str(len(listaFinal))) + " nicks generated.\n") -- print("Writing the results onto the file:\n\t" + general.emphasis(args.outputFile)) -- -- oF=open(args.outputFile, "w") -- for l in listaFinal: -- oF.write(l+"\n") -- oF.close() - - return listaFinal - -@@ -2901,7 +2896,7 @@ def main(params=None): - if args.country != "": - print("Country: ".ljust(20, " ") + args.country) - -- main( -+ aliases = generate( - name=args.name, - surname1=args.surname1, - surname2=args.surname2, -@@ -2915,6 +2910,14 @@ def main(params=None): - extraWords=extraWords - ) - -+ print("Writing the results onto the file:\n\t" + general.emphasis(args.outputFile)) -+ -+ oF=open(args.outputFile, "w") -+ for l in aliases: -+ oF.write(l+"\n") -+ oF.close() -+ -+ - # Urging users to place an issue on Github... - print(banner.footer) diff --git a/debian/patches/series b/debian/patches/series index 00fdd9b..f412023 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,7 +1,7 @@ +use-bs4-by-default.patch cleanup-setup.patch dont-use-validate-email.patch drop-explicit-need-of-importlib.patch upgrade-installation.patch initalize-config.patch add-script-config-upgrade.patch -fix-alias-generator.patch diff --git a/debian/patches/upgrade-installation.patch b/debian/patches/upgrade-installation.patch index eda2c8c..dab1d46 100644 --- a/debian/patches/upgrade-installation.patch +++ b/debian/patches/upgrade-installation.patch @@ -18,7 +18,7 @@ from setuptools import setup, find_packages import shutil import site -@@ -168,6 +169,11 @@ setup( +@@ -109,6 +110,11 @@ setup( 'Topic :: Text Processing :: Markup :: HTML' ], packages=find_packages(), diff --git a/debian/patches/use-bs4-by-default.patch b/debian/patches/use-bs4-by-default.patch new file mode 100644 index 0000000..7e3ae52 --- /dev/null +++ b/debian/patches/use-bs4-by-default.patch @@ -0,0 +1,18 @@ +Description: Use bs4 by default + Mention beautifulsoup4 in setup so that pybuild generates a dependency on + bs4 and not on obsolete beautifulsoup +Author: Sophie Brun +Last-Update: 2018-10-18 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/setup.py ++++ b/setup.py +@@ -115,7 +115,7 @@ setup( + "mechanize", + "requests", + "python-emailahoy", +- "BeautifulSoup", ++ "beautifulsoup4", + "pyexcel==0.2.1", + "pyexcel_ods==0.1.1", + "pyexcel_xls==0.1.0",