include_dirs.append(d) return include_dirs ext_modules = [ Extension('dragnet._weninger', sources=["dragnet/_weninger.pyx"], include_dirs = [get_include()], language="c++"), Extension('dragnet.lcs', sources=["dragnet/lcs.pyx"], include_dirs = [get_include()], language="c++"), Extension('dragnet.blocks', sources=["dragnet/blocks.pyx"], include_dirs = lxml.get_include() + find_libxml2_include(), language="c++", libraries=['xml2']), Extension('dragnet.readability', sources=["dragnet/readability.pyx"], include_dirs = [get_include()], extra_compile_args=['-std=c++0x'], language="c++"), ] setup( name = 'dragnet', version = '1.0.1', description = 'Extract the main article content (and optionally comments) from a web page', author = 'Matt Peters, Dan Lecocq',
include_dirs.append(d) return include_dirs ext_modules = [ Extension('dragnet._weninger', sources=["dragnet/_weninger.pyx"], include_dirs=[get_include()], language="c++"), Extension('dragnet.lcs', sources=["dragnet/lcs.pyx"], include_dirs=[get_include()], language="c++"), Extension('dragnet.blocks', sources=["dragnet/blocks.pyx"], include_dirs=lxml.get_include() + find_libxml2_include(), language="c++", libraries=['xml2']), Extension('dragnet.readability', sources=["dragnet/readability.pyx"], include_dirs=[get_include()], extra_compile_args=['-std=c++0x'], language="c++"), ] setup( name='dragnet', version='1.0.1', description= 'Extract the main article content (and optionally comments) from a web page', author='Matt Peters, Dan Lecocq',
setup(console=['D:\Users\u156726\PycharmProjects\SFR_APP\SFR_APP_BK.py'],options={ 'py2exe': { 'packages' : ['matplotlib', 'pytz'], } }, data_files=matplotlib.get_py2exe_datafiles(),) """ includes = ['matplotlib','datetime','lxml.etree', 'lxml._elementpath', 'gzip','pygal','matplotlib.pyplot','ttk','lxml', 'numpy', 'Tkinter', 'Tkconstants', 'pygal','Tix','matplotlib.backends.backend_qt4agg','matplotlib.ticker','PyQt4','datetime','tkFileDialog','ttk','threading' ,'csv','re','numpy','os','tkinter.tix'] excludes = ['_gtkagg', '_tkagg', 'curses', 'pywin.debugger', 'pywin.debugger.dbgcon', 'pywin.dialogs' ] packages = [] dll_excludes = [] import Tix import lxml lxml.get_include() def files(folder): for path in glob.glob(folder+'/*'): if os.path.isfile(path): yield path class Target: def __init__(self, **kw): self.__dict__.update(kw) self.version = "1.0.0.0" self.company_name = "SFR" self.copyright = "Copyright (c) 2017 KAID Belkacem." self.name = "SFR_Perf_DataAnalyser"
import hashlib from uuid import uuid4 import lxml lxml.get_include() import requests from lxml import etree # Create your tests here. def getBlogList(): con = requests.get('https://blog.csdn.net/p571912102') # print(len(con.content.decode('utf-8'))) content = con.content.decode('utf-8') html_obj = etree.HTML(content) html_str = etree.tostring(html_obj, pretty_print=True) blog_obj_list = html_obj.xpath('//div[@data-articleid]')[1:] for i in blog_obj_list: blog_tag_obj = i.xpath('h4/a/span')[0] blog_data_id = int(i.xpath('@data-articleid')[0]) print('id--->', blog_data_id) blog_content_obj = i.xpath('p/a')[0].text blog_title_obj = i.xpath('h4/a/text()')[1].strip() blog_time_obj_list = i.xpath( '//div[@data-articleid][2]/div/p/span') # 发布时间 阅读 评论 for i in blog_time_obj_list: print('---time--', i.text) detil_url = 'https://blog.csdn.net/p571912102/article/details/{}'.format( blog_data_id)
def include_dirs(): import lxml dirs = xmlsec_config()['include_dirs'] dirs.extend(lxml.get_include()) return dirs
def run(self): ext = self.ext_map['xmlsec'] self.debug = os.environ.get('PYXMLSEC_ENABLE_DEBUG', False) self.static = os.environ.get('PYXMLSEC_STATIC_DEPS', False) if self.static or sys.platform == 'win32': self.info('starting static build on {}'.format(sys.platform)) buildroot = Path('build', 'tmp') self.prefix_dir = buildroot / 'prefix' self.prefix_dir.mkdir(parents=True, exist_ok=True) self.prefix_dir = self.prefix_dir.absolute() self.build_libs_dir = buildroot / 'libs' self.build_libs_dir.mkdir(exist_ok=True) self.libs_dir = Path(os.environ.get('PYXMLSEC_LIBS_DIR', 'libs')) self.libs_dir.mkdir(exist_ok=True) if sys.platform == 'win32': self.prepare_static_build_win() elif 'linux' in sys.platform: self.prepare_static_build_linux() else: import pkgconfig try: config = pkgconfig.parse('xmlsec1') except EnvironmentError: raise DistutilsError('Unable to invoke pkg-config.') except pkgconfig.PackageNotFoundError: raise DistutilsError('xmlsec1 is not installed or not in path.') if config is None or not config.get('libraries'): raise DistutilsError('Bad or incomplete result returned from pkg-config.') ext.define_macros.extend(config['define_macros']) ext.include_dirs.extend(config['include_dirs']) ext.library_dirs.extend(config['library_dirs']) ext.libraries.extend(config['libraries']) import lxml ext.include_dirs.extend(lxml.get_include()) ext.define_macros.extend( [('MODULE_NAME', self.distribution.metadata.name), ('MODULE_VERSION', self.distribution.metadata.version)] ) # escape the XMLSEC_CRYPTO macro value, see mehcode/python-xmlsec#141 for (key, value) in ext.define_macros: if key == 'XMLSEC_CRYPTO' and not (value.startswith('"') and value.endswith('"')): ext.define_macros.remove((key, value)) ext.define_macros.append((key, '"{0}"'.format(value))) break if sys.platform == 'win32': ext.extra_compile_args.append('/Zi') else: ext.extra_compile_args.extend( [ '-g', '-std=c99', '-fPIC', '-fno-strict-aliasing', '-Wno-error=declaration-after-statement', '-Werror=implicit-function-declaration', ] ) if self.debug: ext.extra_compile_args.append('-Wall') ext.extra_compile_args.append('-O0') ext.define_macros.append(('PYXMLSEC_ENABLE_DEBUG', '1')) else: ext.extra_compile_args.append('-Os') super(build_ext, self).run()
from setuptools import setup, Extension from setuptools.command.build_ext import build_ext as setuptools_build_ext from Cython.Build.Cythonize import cythonize import lxml MODE = 'release' class build_ext(setuptools_build_ext): def build_extension(self, ext): subprocess.check_call(['cargo', 'build'] + (['--release'] if MODE == 'release' else [])) setuptools_build_ext.build_extension(self, ext) includes = ['/usr/include/libxml2'] + lxml.get_include() setup( name='htmlpyever', ext_modules=cythonize([ Extension( name='htmlpyever', sources=['htmlpyever.pyx'], libraries=['html5ever_glue', 'xml2'], library_dirs=['target/{}'.format(MODE)], include_dirs=includes, depends=['target/{}/libhtml5ever_glue.a'.format(MODE)], ) ], include_path=includes), setup_requires=['cython'], install_requires=['lxml'],