setup.py 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import glob
  2. from setuptools import setup, find_packages
  3. import os
  4. # 读取 requirements.txt 文件内容
  5. def read_requirements():
  6. req_path = "requirements.txt"
  7. if not os.path.exists(req_path):
  8. return []
  9. with open(req_path, encoding="utf-8") as f:
  10. return [line.strip() for line in f if line.strip() and not line.startswith("#")]
  11. # 找出所有根目录下的.py文件(不包括__init__.py)
  12. def find_py_modules():
  13. return [os.path.splitext(os.path.basename(f))[0]
  14. for f in glob.glob("*.py")
  15. if os.path.isfile(f) and not f.startswith('__init__')]
  16. setup(
  17. name="crossborder",
  18. version="0.1.0",
  19. packages=find_packages(where="."),
  20. package_dir={"": "."},
  21. # 添加根目录下的.py文件
  22. py_modules=find_py_modules(),
  23. include_package_data=True,
  24. install_requires=read_requirements(),
  25. python_requires='>=3.6',
  26. entry_points={
  27. 'console_scripts': [
  28. 'run-shandong=shandong.selenium_shandong_download:main',
  29. 'run-guangdong=guangdong.selenium_guangdong_download:main',
  30. 'run-guangdong-city=guangdong.selenium_guangdong_city:main',
  31. 'run-henan=henan.selenium_henan_download:main',
  32. 'run-fujian=fujian.selenium_fujian_download.py:main',
  33. 'run-anhui=anhui.crawl_gov_anhui_full:main',
  34. 'run-jiangsu=jiangsu.gov_commodity_jiangsu_country:main',
  35. 'run-hebei=hebei.crawl_gov_hebei_full:main',
  36. 'run-zhejiang=zhejiang.crawl_gov_zhejiang_full:main',
  37. 'run-quanguo=quanguo.selenium_download:main',
  38. # 统一入口命令
  39. 'run-crossborder=cli:main',
  40. ],
  41. },
  42. )