Browse Source

added a Makefile for faster dev, and clean command to remove eggs, wheels, builds, dist - anything that clutters devspace

version-14
Achilles Rasquinha 7 years ago
parent
commit
a38b6913ce
2 changed files with 39 additions and 1 deletions
  1. +2
    -0
      Makefile
  2. +37
    -1
      setup.py

+ 2
- 0
Makefile View File

@@ -0,0 +1,2 @@
clean:
python setup.py clean

+ 37
- 1
setup.py View File

@@ -1,3 +1,7 @@
# imports - standard imports
import os, shutil
from distutils.command.clean import clean as Clean

from setuptools import setup, find_packages
from pip.req import parse_requirements
import re, ast
@@ -11,6 +15,34 @@ with open('frappe/__init__.py', 'rb') as f:

requirements = parse_requirements("requirements.txt", session="")

class CleanCommand(Clean):
def run(self):
Clean.run(self)

basedir = os.path.abspath(os.path.dirname(__file__))

for relpath in ['build', '.cache', '.coverage', 'dist', 'frappe.egg-info']:
abspath = os.path.join(basedir, relpath)
if os.path.exists(abspath):
if os.path.isfile(abspath):
os.remove(abspath)
else:
shutil.rmtree(abspath)

for dirpath, dirnames, filenames in os.walk(basedir):
for filename in filenames:
_, extension = os.path.splitext(filename)
if extension in ['.pyc']:
abspath = os.path.join(dirpath, filename)
os.remove(abspath)
for dirname in dirnames:
if dirname in ['__pycache__']:
abspath = os.path.join(dirpath, dirname)
shutil.rmtree(abspath)

setup(
name='frappe',
version=version,
@@ -21,5 +53,9 @@ setup(
zip_safe=False,
include_package_data=True,
install_requires=[str(ir.req) for ir in requirements],
dependency_links=[str(ir._link) for ir in requirements if ir._link]
dependency_links=[str(ir._link) for ir in requirements if ir._link],
cmdclass = \
{
'clean': CleanCommand
}
)

Loading…
Cancel
Save