PK!Lt22poetry_org/__init__.py__version__ = '0.1.1' from .poetry_org import *PK!  poetry_org/poetry_org.pyfrom pathlib import Path import toml import logging logging.basicConfig(level=logging.INFO, format='%(levelname)s :: %(message)s') def main(): try: toml_data = toml.load('pyproject.toml', _dict=dict) except FileNotFoundError as e: logging.error('Poetry TOML file not found. \n \ Run poetry_org in the Poetry project root directory.') return app_name = toml_data['tool']['poetry']['name'].replace('-','_') app_name_hyphens = app_name.replace('_','-') exclude_files = [ 'pyproject.toml', 'poetry.lock', 'requirements.txt', 'readme.md', 'readme.rst', 'license', '.gitignore', '__pycache__', 'dist', app_name + '.egg-info', 'tests', app_name, ] proj_dir = Path.cwd() items = proj_dir.glob('*') '''Make app directory''' app_dir = proj_dir / app_name app_dir.mkdir(parents=True, exist_ok=True) '''Check for app_name.py''' app_file = proj_dir / (app_name + '.py') if not app_file.exists(): app_file_hyphens = proj_dir / (app_name_hyphens + '.py') if app_file_hyphens.exists(): app_file_hyphens.rename(app_file) logging.warning(f'Renamed {app_name_hyphens}.py to {app_name}.py') else: new_app_path = app_dir / (app_name + '.py') if not new_app_path.exists(): logging.error(f'App file not found: {app_name}.py') return '''Copy app files into app directory''' for item in items: if not item.name.lower() in exclude_files: logging.info(f'Moving ./{item.name} --> ./{app_name}/{item.name}') new_item_path = app_dir/item.name if new_item_path.exists(): logging.error(f'File ./{app_name}/{new_item_path.name} already exists!\n ** Merge files and re-run script. **') return item.replace(new_item_path) '''Create __init__ file text''' pyfiles = app_dir.glob('*.py') init_file = app_dir / '__init__.py' init_imports = ["__version__ = \'0.1.0\'\n"] for pyfile in pyfiles: if pyfile.name != '__init__.py': init_imports.append('from .' + pyfile.stem + ' import *') '''Write __init__.py file''' init_file.write_text('\n'.join(init_imports)) logging.info(f'Updated file __init__.py in ./{app_name}/') logging.info(f'Success! File structure of app {app_name} is ready for `poetry build`.\n') return if __name__ == '__main__': main() PK!H/*.+poetry_org-0.1.1.dist-info/entry_points.txtN+I/N.,()*O-)/J0L<..PK!HڽTU poetry_org-0.1.1.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H®#poetry_org-0.1.1.dist-info/METADATATMo0 W%b5] bE`ڴHX+6k$Oy~?(d'ߠ"IcxϏB(2mfSVJ&%/'(% ]ȤrcaU2|ξQ%qmqceڑf.j_Kк۴0E,cpE ]ciBF%J%g'R8'sToq s*k635WY[k5a]`5|O1xJъ|:91K=j=4?EV3Ɨ8,AX GmҞdFm/ ׭qS{`E8q`졐:t@V0K}$4 DDh-f*UݥI-%"+t&lFo:Cnj5*w= #k>퉄~Dd  pKL ?`[wѹ@];Qx "l`q,{^E{' 2G7"6]ikF@R5}M](Qloz8͌,rEЧEvy\e)OÒetrbI+ZL錱eZ91yn+49% PK!H 1!poetry_org-0.1.1.dist-info/RECORD}r@н2(QXdW6S :<"|}ѕ՛[UvuY`ZOIN(uDrpҡ:`|:a=7ph"mθ% = G%vKp6f-Qm}y?\g^_AsHC 9mNAj iX'RuvقY:ڑBȧ80k ]_?.m&!YavZǍdvl{|H;}ES|) Vrc*. dh"}N$_ώ7ޞPK!Lt22poetry_org/__init__.pyPK!  fpoetry_org/poetry_org.pyPK!H/*.+ poetry_org-0.1.1.dist-info/entry_points.txtPK!HڽTU  poetry_org-0.1.1.dist-info/WHEELPK!H®# poetry_org-0.1.1.dist-info/METADATAPK!H 1!poetry_org-0.1.1.dist-info/RECORDPK