···11import sys
22from cx_Freeze import setup, Executable
3344+# After running the setup file (python setup.py build) the scrapy/VERSION file has to be manually put into the
55+# library.zip, also the FourmiCrawler map has to be copied to both the library and the exe.win32-2.7 folder. after
66+# putting the files in the library the library has to be zipped and replace the old library.
47# Dependencies are automatically detected, but it might need fine tuning.
55-build_exe_options = {"packages": ["os", "scrapy", "lxml._elementpath"], "excludes": ["tkinter"]}
88+build_exe_options = {"packages": ["os", "scrapy", "lxml", "w3lib", "pkg_resources", "zope.interface"], "excludes": []}
69710# GUI applications require a different base on Windows (the default is for a
811# console application).
+13-5
sourceloader.py
···11import inspect
22+import sys
23import os
34import re
45from FourmiCrawler.sources.source import Source
···89 sources = []
9101011 def __init__(self, rel_dir="FourmiCrawler\\sources"):
1111- path = os.path.dirname(os.path.abspath(__file__))
1212- path += "\\" + rel_dir
1313- known_parser = set()
1212+1313+ if hasattr(sys,'frozen'):
1414+ path = os.path.dirname(sys.executable)
1515+ path += "\\" + rel_dir
1616+ known_parser = set()
1717+1818+ else:
1919+ path = os.path.dirname(os.path.abspath(__file__))
2020+ path += "\\" + rel_dir
2121+ known_parser = set()
14221523 for py in [f[:-3] for f in os.listdir(path) if f.endswith('.py') and f != '__init__.py']:
1624 mod = __import__('.'.join([rel_dir.replace('\\', "."), py]), fromlist=[py])
1725 classes = [getattr(mod, x) for x in dir(mod) if inspect.isclass(getattr(mod, x))]
1826 for cls in classes:
1927 if issubclass(cls, Source) and cls not in known_parser:
2020- self.sources.append(cls()) # [review] - Would we ever need arguments for the parsers?
2121- known_parser.add(cls)
2828+ self.sources.append(cls()) # [review] - Would we ever need arguments for the parsers?
2929+ # known_parser.add(cls)
22302331 def include(self, source_names):
2432 new = set()