diff --git a/Changes.txt b/Changes.txt new file mode 100644 index 0000000..e326f19 --- /dev/null +++ b/Changes.txt @@ -0,0 +1,13 @@ + changes log +====================================== + +------------------------------ + + +------------------------------ +0.0.1 2023-11-10 + +1.开始规划,先调研一下怎么做 +2.提交基础框架 + +[mh] diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 0000000..650a9fe --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,5 @@ +include README.txt +include requirements.txt tox.ini +recursive-include test *.txt *.py +recursive-include *.txt *.py *.tmpl +recursive-include bin *.* diff --git a/release.py b/release.py new file mode 100644 index 0000000..b4f25e7 --- /dev/null +++ b/release.py @@ -0,0 +1,101 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" + create zip 安装包 +""" + +import logging +import os.path +import shutil +import sys + + +def _copytree(src, dst, ignore=None): + + names = os.listdir(src) + if ignore is not None: + ignored_names = ignore(src, names) + else: + ignored_names = set() + try: + os.makedirs(dst) + except Exception: + pass + errors = [] + for name in names: + if name in ignored_names: + continue + srcname = os.path.join(src, name) + dstname = os.path.join(dst, name) + try: + if os.path.isdir(srcname): + shutil.copytree(srcname, dstname, ignore=ignore) + else: + # Will raise a SpecialFileError for unsupported file types + shutil.copy2(srcname, dstname) + # catch the Error from the recursive copytree so that we can + # continue with other files + except shutil.Error as err: + errors.extend(err.args[0]) + except EnvironmentError as why: + errors.append((srcname, dstname, str(why))) + try: + shutil.copystat(src, dst) + except OSError as why: + if WindowsError is not None and isinstance(why, WindowsError): + # Copying file access times may fail on Windows + pass + else: + errors.extend((src, dst, str(why))) + if errors: + raise shutil.Error(errors) + + +def _zip_file(target_dir): + root_dir = os.path.dirname(target_dir) + os.chdir(root_dir) + shutil.make_archive(os.path.basename(target_dir), format="gztar", + base_dir=os.path.basename(target_dir)) + + +def _strip_py(py_dir): + for base, dirs, files in os.walk(py_dir): + for name in files: + if name.endswith('.py'): + path = os.path.join(base, name) + logging.debug("Deleting %s", path) + os.unlink(path) + + +def main(): + # src_dir = sys.argv[1] + site_pacakge_dir = sys.argv[2] + target_dir = sys.argv[3] + + top_dir = sys.argv[4] + + shutil.rmtree(target_dir, ignore_errors=True) + os.makedirs(target_dir) + + for dir in ("bin", "etc"): + _copytree(os.path.join(top_dir, dir), + os.path.join(target_dir, dir)) + + shutil.copy2(os.path.join(top_dir, "README.md"), + os.path.join(target_dir, "README.md")) + + target_lib_dir = os.path.join(target_dir, "lib") + _copytree(site_pacakge_dir, target_lib_dir) + + _zip_file(target_dir) + + print("") + print("output dir %s" %(target_dir)) + +if __name__ == '__main__': + try: + main() + except Exception: + logging.exception("main except") + sys.exit(1) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..c970ee3 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,4 @@ +faker==19.12.0 +schedule==1.2.1 +JayDeBeApi==1.2.3 + diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..18e147f --- /dev/null +++ b/setup.py @@ -0,0 +1,32 @@ +from setuptools import setup, find_packages + + +install_requires=[] + +for line in open('requirements.txt'): + install_requires.append(line.strip()) + +setup(name='dataCreatingGUI', + version='0.0.1', + description='', + long_description="""\ +""", + # Get more strings from http://www.python.org/pypi?%3Aaction=list_classifiers # nopep8 + classifiers=[ + "Programming Language :: Python", + ], + keywords='', + author='mh', + author_email='menghan@unary.com.cn', + url='', + license='GPL', + packages=find_packages(exclude=["ez_setup","test.*", "test"]), + namespace_packages=[], + include_package_data=True, + test_suite='nose.collector', + zip_safe=False, + install_requires=install_requires, + entry_points=""" + # -*- Entry points: -*- + """, + ) diff --git a/start_vscode.bat b/start_vscode.bat new file mode 100644 index 0000000..f41bc1c --- /dev/null +++ b/start_vscode.bat @@ -0,0 +1,6 @@ + +set PROJECT_HOME=%~dp0 + + +rem 确保vscode在path里面 +start code %PROJECT_HOME% diff --git a/tox.ini b/tox.ini new file mode 100644 index 0000000..7c85387 --- /dev/null +++ b/tox.ini @@ -0,0 +1,53 @@ +[tox] +envlist = devenv +minversion = 1.6 +skipsdist = False + +[testenv] +install_command = pip install --force-reinstall -U {opts} {packages} +setenv = VIRTUAL_ENV={envdir} + NOSE_WITH_COVERAGE=1 + NOSE_COVER_BRANCHES=1 +deps = + -r{toxinidir}/requirements.txt + + +[testenv:devenv] +envdir = devenv +basepython = python3.8 +usedevelop = True + + + +[testenv:devenv2] +envdir = devenv2 +basepython = python2.7 +usedevelop = True + + +[testenv:py38-release] +basepython = python3.8 +deps = + -r{toxinidir}/requirements.txt + +commands = + {envpython} {toxinidir}/release.py {envdir} {envsitepackagesdir} {toxinidir}/build/dataCreating_v1.0.0 {toxinidir} + + +[testenv:py310-release] +basepython = python3.10 +deps = + -r{toxinidir}/requirements.txt + +commands = + {envpython} {toxinidir}/release.py {envdir} {envsitepackagesdir} {toxinidir}/build/dataCreating_v1.0.0 {toxinidir} + + +[testenv:py27-release] +basepython = python2.7 +deps = + -r{toxinidir}/requirements.txt + +commands = + {envpython} {toxinidir}/release.py {envdir} {envsitepackagesdir} {toxinidir}/build/excel2feature {toxinidir} +