Skip to content

Commit 62728c3

Browse files
authored
Merge pull request #80 from Alinvor/kernel
[DONE]合并分支
2 parents e1edd65 + 42f96fe commit 62728c3

File tree

5 files changed

+160
-55
lines changed

5 files changed

+160
-55
lines changed

.rmcache.bash

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
#!/usr/bin/env bash
22

3-
## THE DELETE FILES
3+
### THE DELETE FILES
44
find . -type f -name '*.pyc' -delete
55

6-
## THE DELETE DIRECTORY
7-
# ./build/*
6+
### THE DELETE DIRECTORY
7+
## .tox/*
8+
find .tox -path "*" -delete
9+
## ./build/*
810
find ./build -path "*" ! -name "build" -delete
9-
# ./src/com.dvsnier.*.egg-info
11+
## ./src/com.dvsnier.*.egg-info
1012
find ./src -path "*com.dvsnier*" -delete
1113
# find ./src -path "*com.dvsnier.*" -type d -exec rm -r {} +
1214
# find ./src -path "*com.dvsnier.*" -type f -delete
13-
# ./dist/*
15+
## ./dist/*
1416
find ./dist -path "*" ! -name "dist" -delete
15-
# ./out/log/*
17+
## ./out/log/*
1618
find ./out/log -path "*" ! -name "log" -delete
17-
# __pycache__
19+
## __pycache__
1820
find . -type d -name __pycache__ -exec rm -r {} +

.rmcache.ps1

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,21 @@
44
# 1. https://docs.microsoft.com/zh-cn/powershell/scripting/samples/working-with-files-and-folders?view=powershell-7.1
55
# 2. https://docs.microsoft.com/zh-cn/powershell/scripting/samples/working-with-registry-keys?view=powershell-7.1
66
#
7-
## THE DELETE FILES
7+
8+
### THE DELETE FILES
89
Get-ChildItem -Path . -include *.pyc -Recurse | Remove-Item
9-
## THE DELETE DIRECTORY
10-
# ./build/*
10+
11+
### THE DELETE DIRECTORY
12+
## .tox/*
13+
Remove-Item -Path .\.tox -Recurse
14+
## ./build/*
1115
Remove-Item -Path .\build\* -Recurse
12-
# ./src/com.dvsnier.*.egg-info
16+
## ./src/com.dvsnier.*.egg-info
1317
Remove-Item -Path .\src\com.dvsnier.*.egg-info -Recurse
1418
# Get-ChildItem -Path .\src\com.dvsnier.*.egg-info -Recurse
15-
# ./dist/*
19+
## ./dist/*
1620
Remove-Item -Path .\dist\* -Recurse
17-
# ./out/log/*
21+
## ./out/log/*
1822
Remove-Item -Path .\out\log\* -Recurse
19-
# __pycache__
23+
## __pycache__
2024
Get-ChildItem -Path . -include __pycache__ -Recurse | Remove-Item

README.md

Lines changed: 88 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -233,8 +233,8 @@ python3 -m pip list > ./Temp/python3_pip_list.txt
233233

234234
```bash
235235
# pip cache list
236-
python2 -m pip cache list > ./out/dist/pip2_cache_list.txt
237-
python3 -m pip cache list > ./out/dist/pip3_cache_list.txt
236+
python2 -m pip cache list > ./out/dist/python2_pip2_cache_list.txt
237+
python3 -m pip cache list > ./out/dist/python3_pip3_cache_list.txt
238238
# pip no cache install
239239
python2 -m pip --no-cache-dir install com.dvsnier.*
240240
python3 -m pip --no-cache-dir install com.dvsnier.*
@@ -313,7 +313,8 @@ tox-quickstart
313313
tox
314314

315315
# the recommend
316-
tox --result-json ./Temp/tox/tox_result.json
316+
tox --result-json ./Temp/tox/python2_tox_result.json
317+
tox --result-json ./Temp/tox/python3_tox_result.json
317318
```
318319

319320
### 4.5 twine version
@@ -347,22 +348,29 @@ Python 软件包开发工程结构,如下所示:
347348
| --- doc
348349
--- ...
349350
--- README.md
351+
| --- out
350352
| --- src
351353
--- com
352354
--- dvsnier
353355
--- ...
354-
| --- test
356+
| --- Temp
357+
| --- template
358+
| --- tests
355359
--- com
356360
--- dvsnier
357361
--- ...
358362
| --- venv
359363
| --- venv2
360364
| --- .editorconfig
365+
| --- .env
361366
| --- .gitignore
367+
| --- .rmcache.bash
368+
| --- .rmcache.ps1
362369
| --- LICENSE.txt
363370
| --- MANIFEST.in
364371
| --- pyproject.toml
365372
| --- README.md
373+
| --- requirements.txt
366374
| --- setup.cfg
367375
| --- tox.ini
368376
```
@@ -371,48 +379,54 @@ Python 软件包开发工程结构,如下所示:
371379

372380
首先检查是否安装如下依赖:
373381

374-
1. pip
375-
2. flake8 (可选)
376-
3. virtualenv
377-
4. setuptools
378-
5. wheel
379-
6. discover
380-
7. tox
381-
8. toml (可选)
382-
9. tox-travis (可选)
383-
10. build
384-
11. twine
382+
1. build
383+
2. discover
384+
3. flake8 (可选)
385+
4. pip
386+
5. setuptools
387+
6. tox
388+
7. toml (可选)
389+
8. tox-travis (可选)
390+
9. twine
391+
10. unittest2
392+
11. virtualenv
393+
12. wheel
394+
385395

386396
如若没有,请使用`pip` 命令安装如下软件包:
387397

388398
```bash
389399
# python2 pip version
390400
python2 -m pip --version
391401

402+
python2 -m pip install build
403+
python2 -m pip install discover
392404
python2 -m pip install flake8
393-
python2 -m pip install virtualenv
405+
python2 -m pip install pip
394406
python2 -m pip install setuptools
395-
python2 -m pip install wheel
396-
python2 -m pip install discover
397407
python2 -m pip install tox
398408
python2 -m pip install toml
399409
python2 -m pip install tox-travis
400-
python2 -m pip install build
401410
python2 -m pip install twine
411+
python2 -m pip install unittest2
412+
python2 -m pip install virtualenv
413+
python2 -m pip install wheel
402414

403415
# python3 pip version
404416
python3 -m pip --version
405417

418+
python3 -m pip install build
419+
python3 -m pip install discover
406420
python3 -m pip install flake8
407-
python3 -m pip install virtualenv
421+
python3 -m pip install pip
408422
python3 -m pip install setuptools
409-
python3 -m pip install wheel
410-
python3 -m pip install discover
411423
python3 -m pip install tox
412424
python3 -m pip install toml
413425
python3 -m pip install tox-travis
414-
python3 -m pip install build
415426
python3 -m pip install twine
427+
python3 -m pip install unittest2
428+
python3 -m pip install virtualenv
429+
python3 -m pip install wheel
416430
```
417431

418432
其实一般安装有 `pip` 软件包的,一般都会有`setuptools``wheel` 软件包附带安装;
@@ -457,6 +471,9 @@ include *.md
457471

458472
# Include the license file
459473
include LICENSE.txt
474+
475+
# # Include the requirements file
476+
include requirements.txt
460477
```
461478

462479
同上,模板一般都是固定结构,无需太范围改动;
@@ -473,7 +490,7 @@ include LICENSE.txt
473490
# For information see https://tox.readthedocs.io/en/latest/examples.html
474491

475492
[tox]
476-
envlist = py27, py39
493+
envlist = py27, py38
477494

478495
minversion = 3.23.1
479496

@@ -485,20 +502,38 @@ isolated_build = true
485502
# install testing framework
486503
# ... or install anything else you might need here
487504
[testenv]
505+
passenv =
506+
PYTHONPATH
488507
platform = linux: linux
489508
macos: darwin
490509
windows: win32
491510
; alwayscopy = True
492511
allowlist_externals =
493512
/bin/bash
494-
changedir =
495-
tests
513+
; changedir =
514+
; tests
515+
#
516+
# https://tox.readthedocs.io/en/latest/config.html#conf-deps
517+
# https://tox.readthedocs.io/en/latest/example/basic.html#a-simple-tox-ini-default-environments
518+
#
496519
deps =
497-
build
520+
-rrequirements.txt
521+
unittest2
522+
flake8
523+
virtualenv
524+
setuptools
525+
wheel
498526
discover
527+
tox
528+
toml
529+
tox-travis
530+
build
499531
twine
500532
commands =
501-
discover
533+
; windows: python --version
534+
; macos,linux: python --version
535+
discover -s ./tests -t .
536+
; unit2 discover []
502537
; python -m unittest discover
503538
```
504539

@@ -533,10 +568,11 @@ platforms = any
533568
# Development Status :: 5 - Production/Stable
534569
classifiers =
535570
Development Status :: 3 - Alpha
571+
Topic :: Software Development :: Libraries
572+
License :: OSI Approved :: MIT License
536573
Programming Language :: Python :: 2.7
537574
Programming Language :: Python :: 3.8
538575
Programming Language :: Python :: 3.9
539-
License :: OSI Approved :: MIT License
540576

541577
python_requires =
542578
>=2.7
@@ -582,6 +618,7 @@ https://github.com/Alinvor/Python-DeMo
582618
"""
583619

584620
# Always prefer setuptools over distutils
621+
# from setuptools import setup, find_packages, find_namespace_packages
585622
from setuptools import setup, find_packages
586623
import os
587624
import sys
@@ -599,9 +636,8 @@ def read_text(file_name):
599636
content += str(line).encode('utf-8')
600637
# print(content)
601638
return content
602-
#
603-
# the repaired your home name
604-
#
639+
640+
605641
project = os.getenv('BASE_PROJECT_PREFIX')
606642
if project is None:
607643
raise KeyError('the please configure BASE_PROJECT_PREFIX environment variable, otherwise it cannot run')
@@ -640,7 +676,7 @@ PROJECT_DESCRIPTION = os.path.join(README_PROJECT_DIRECTORY, PROJECT_README_FILE
640676
# | 21 | DVSNIER_PROJECT_URLS | dict | | 项目 URL | |
641677
# | 22 | | | | | |
642678
DVSNIER_NAME = 'com.dvsnier.xxx' # Required
643-
DVSNIER_VERSION = '0.0.1.dev1' # Required
679+
DVSNIER_VERSION = '0.0.1.dev0' # Required
644680
DVSNIER_DESCRIPTOIN = 'this is dvsnier xxx.' # Optional
645681
# Get the long description from the README file
646682
DVSNIER_LONG_DESCRIPTOIN = read_text(str(PROJECT_DESCRIPTION)) # Optional
@@ -678,14 +714,11 @@ DVSNIER_PACKAGE_DIR = {'': 'src'} # Optional
678714
# DVSNIER_PY_MODULES = ["xxx"] # Required
679715
# DVSNIER_PACKAGES = find_packages(include=['xxx', 'xxx.*']) # Required
680716
DVSNIER_PACKAGES = find_packages(where='src') # Required
717+
# DVSNIER_NAMESPACE_PACKAGES = find_namespace_packages(include=['com.*']) # Required
681718
# DVSNIER_PYTHON_REQUIRES = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*'
682719
DVSNIER_PYTHON_REQUIRES = '>=2.7, <4'
683720
DVSNIER_INSTALL_REQUIRES = [ # Optional
684-
# 'discover==0.4.0',
685-
# 'build==0.4.0',
686-
# 'pathlib2==2.3.5',
687-
# 'toml==0.10.2',
688-
# 'twine==1.15.0',
721+
689722
]
690723
DVSNIER_EXTRAS_REQUIRE = { # Optional
691724
'dev': ['check-manifest'],
@@ -815,6 +848,11 @@ setup(
815848
#
816849
packages=DVSNIER_PACKAGES, # Required
817850

851+
#
852+
# Only for Python 3.x and above
853+
#
854+
# namespace_packages=DVSNIER_NAMESPACE_PACKAGES, # Optional
855+
818856
# If your project contains any single-file Python modules that aren’t part of
819857
# a package, set py_modules to a list of the names of the modules (minus the .py
820858
# extension) in order to make setuptools aware of them.
@@ -866,6 +904,14 @@ setup(
866904
# executes the function `main` from this package when invoked:
867905
entry_points=DVSNIER_ENTRY_POINTS, # Optional
868906

907+
#
908+
# 1. https://www.python.org/dev/peps/pep-0328/
909+
# 2. https://setuptools.readthedocs.io/en/latest/userguide/package_discovery.html
910+
# 3. https://packaging.python.org/guides/packaging-namespace-packages/
911+
# 4. https://github.com/pypa/sample-namespace-packages/tree/master/pkgutil
912+
#
913+
zip_safe=False,
914+
869915
# List additional URLs that are relevant to your project as a dict.
870916
#
871917
# This field corresponds to the "Project-URL" metadata fields:
@@ -877,7 +923,6 @@ setup(
877923
# what's used to render the link text on PyPI.
878924
project_urls=DVSNIER_PROJECT_URLS, # Optional
879925
)
880-
881926
```
882927
883928
> 软件包`名称`和软件包`版本`信息, 一定要明确具体发布规则;
@@ -902,6 +947,10 @@ tox-quickstart
902947
903948
```bash
904949
tox
950+
951+
python2 -m tox --result-json ./Temp/help/python2_tox_result_json.txt
952+
python3 -m tox --result-json ./Temp/help/python3_tox_result_json.txt
953+
905954
```
906955
907956
#### 5.3.2 build

0 commit comments

Comments
 (0)