forked from avocado-framework/avocado-vt
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request avocado-framework#3184 from ana/makefile_setup.py_…
…update Fix default target in Makefile and add custom command clean to setup.py
- Loading branch information
Showing
2 changed files
with
30 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,11 +13,37 @@ | |
# Author: Lucas Meneghel Rodrigues <[email protected]> | ||
|
||
# pylint: disable=E0611 | ||
import os | ||
import shutil | ||
from distutils.command.clean import clean | ||
from pathlib import Path | ||
from setuptools import setup, find_packages | ||
|
||
VERSION = open('VERSION', 'r').read().strip() | ||
|
||
|
||
class Clean(clean): | ||
"""Our custom command to get rid of scratch files after build.""" | ||
|
||
description = "Get rid of scratch, byte files and build stuff." | ||
|
||
def run(self): | ||
super().run() | ||
cleaning_list = ["MANIFEST", "BUILD", "BUILDROOT", "SPECS", | ||
"RPMS", "SRPMS", "SOURCES", "PYPI_UPLOAD", "./build"] | ||
|
||
cleaning_list += list(Path('.').rglob("*.pyc")) | ||
cleaning_list += list(Path('.').rglob("__pycache__")) | ||
|
||
for e in cleaning_list: | ||
if not os.path.exists(e): | ||
continue | ||
if os.path.isfile(e): | ||
os.remove(e) | ||
if os.path.isdir(e): | ||
shutil.rmtree(e) | ||
|
||
|
||
def pre_post_plugin_type(): | ||
try: | ||
from avocado.core.plugin_interfaces import JobPreTests as Pre | ||
|
@@ -68,5 +94,6 @@ def pre_post_plugin_type(): | |
], | ||
}, | ||
install_requires=["netifaces", "simplejson", "six", "netaddr", | ||
"aexpect", "avocado-framework>=68.0"] | ||
"aexpect", "avocado-framework>=68.0"], | ||
cmdclass={'clean': Clean}, | ||
) |