from pathlib import Path import subprocess app=Path('/home/dunerealms/apps/oscommerce') p=app/'lib/frontend/components/CartFactory.php';s=p.read_text() needle=' public static function work() {' if 'DuneProductRules::validateCartRequest' not in s: s=s.replace(needle,needle+"\n require_once __DIR__.'/DuneProductRules.php';\n DuneProductRules::validateCartRequest();",1) s=s.replace(' DuneProductRules::validateCartRequest();',' \\frontend\\components\\DuneProductRules::validateCartRequest();') p.write_text(s) p=app/'lib/frontend/themes/basic/boxes/product/attributes/select.tpl';s=p.read_text() needle='name="attr_text[{$item.id}]"' if 'maxlength="80"' not in s: s=s.replace(needle,needle+'{if $item.title == \'Preferred name\'} required maxlength="80" aria-label="Preferred name for embroidery (required)" placeholder="Enter the name to embroider"{/if}',1) if 'dune-option-label' not in s: s=s.replace('