99
1010When any of these tools are invoked, this file is loaded and parsed to
1111determine special rules on how to handle building the code and / or data.
12+
13+ python -m twine upload --verbose dist/*
14+
15+ cd docs
16+ sphinx-build -M html . temp\b uild
17+
1218"""
1319
1420# pylint: disable=unused-argument
1723
1824import os
1925import sys
20- from burger import import_py_script , run_command , clean_directories
26+ from burger import clean_directories , run_command , __version__ , \
27+ delete_directory , clean_files , lock_files , unlock_files
2128
2229# If set to True, ``buildme -r``` will not parse directories in this folder.
2330BUILDME_NO_RECURSE = False
2835# If set to True, ``cleanme -r``` will not parse directories in this folder.
2936CLEANME_NO_RECURSE = True
3037
31- CLEANME_CONTINUE = True
38+ # ``cleanme`` will clean the listed folders before cleaning this folder.
39+ CLEANME_DEPENDENCIES = []
40+
41+ # Directories to clean
42+ CLEAN_DIR_LIST = [
43+ "makeprojects.egg-info" ,
44+ "makeprojects-" + __version__ ,
45+ "dist" ,
46+ "build" ,
47+ "temp" ,
48+ ".pytest_cache" ,
49+ ".tox" ,
50+ ".vscode"
51+ ]
52+
53+ # Recurse these directories clean
54+ CLEAN_DIR_RECURSE_LIST = (
55+ "temp" ,
56+ "__pycache__" ,
57+ "_build"
58+ )
59+
60+ # Delete any files with these extensions
61+ CLEAN_EXTENSION_LIST = (
62+ "*.pyc" ,
63+ "*.pyo"
64+ )
3265
3366########################################
3467
@@ -51,10 +84,20 @@ def build(working_directory, configuration):
5184 None if not implemented, otherwise an integer error code.
5285 """
5386
54- # Call setup.py to create the distribution files.
55- run_command (
56- ("python" , "setup.py" , "sdist" , "bdist_wheel" ),
57- working_dir = working_directory )
87+ # Unlock the files to handle Perforce locking
88+ lock_list = unlock_files (working_directory ) + \
89+ unlock_files (os .path .join (working_directory , "makeprojects" ))
90+
91+ try :
92+ # Use "build" from python to build everything
93+ run_command (
94+ ("python" , "-m" , "build" ),
95+ working_dir = working_directory )
96+
97+ # If any files were unlocked, relock them
98+ finally :
99+ lock_files (lock_list )
100+
58101 return 0
59102
60103########################################
@@ -77,13 +120,21 @@ def clean(working_directory):
77120 None if not implemented, otherwise an integer error code.
78121 """
79122
80- # Clean up tox, or pylint
81- clean_directories (working_directory , "temp" )
123+ # Delete all folders, including read only files
124+ for item in CLEAN_DIR_LIST :
125+ delete_directory (os .path .join (working_directory , item ))
126+
127+ clean_directories (
128+ working_directory ,
129+ CLEAN_DIR_RECURSE_LIST ,
130+ recursive = True )
131+
132+ # Delete all *.pyc and *.pyo files
133+ clean_files (
134+ working_directory ,
135+ name_list = CLEAN_EXTENSION_LIST ,
136+ recursive = True )
82137
83- # The function exists in setup.py.
84- # It can be manually invoked with "setup.py clean"
85- setup = import_py_script (os .path .join (working_directory , "setup.py" ))
86- setup .clean (working_directory )
87138 return 0
88139
89140
0 commit comments