Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions pydatastructs/trees/binary_trees.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
from pydatastructs.miscellaneous_data_structures import Stack
from pydatastructs.linear_data_structures import OneDimensionalArray
from pydatastructs.linear_data_structures.arrays import ArrayForTrees
from pydatastructs.utils.misc_util import (
Backend, raise_if_backend_is_not_python)
from pydatastructs.utils.misc_util import Backend
from pydatastructs.trees._backend.cpp import _trees

__all__ = [
Expand Down
18 changes: 9 additions & 9 deletions pydatastructs/utils/testing_util.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
try:
import pytest
except ImportError:
raise Exception("pytest must be installed. Use `pip install pytest` "
"to install it.")

import os
import pathlib
import glob
Expand All @@ -30,6 +24,12 @@ def test(submodules=None, only_benchmarks=False,
List of submodules test to run. By default runs
all the tests
"""
try:
import pytest
except ImportError:
raise Exception("pytest must be installed. Use `pip install pytest` "
"to install it.")

# set benchmarks size
os.environ["PYDATASTRUCTS_BENCHMARK_SIZE"] = str(benchmarks_size)
test_files = []
Expand All @@ -53,7 +53,7 @@ def test(submodules=None, only_benchmarks=False,
raise Exception("Submodule should be of type: str or module")
if sub in path:
if not only_benchmarks:
if not 'benchmarks' in path:
if 'benchmarks' not in path:
test_files.append(path)
else:
if 'benchmarks' in path:
Expand All @@ -69,14 +69,14 @@ def test(submodules=None, only_benchmarks=False,
if skip_test:
continue
if not only_benchmarks:
if not 'benchmarks' in path:
if 'benchmarks' not in path:
test_files.append(path)
else:
if 'benchmarks' in path:
test_files.append(path)

extra_args = []
if not kwargs.get("n", False) is False:
if kwargs.get("n", False) is not False:
extra_args.append("-n")
extra_args.append(str(kwargs["n"]))

Expand Down
37 changes: 24 additions & 13 deletions scripts/build/develop.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,28 @@
import os, argparse
import argparse
import subprocess
import sys

parser = argparse.ArgumentParser(description='Process build options.')
parser.add_argument('--clean', type=bool, default=False,
help='Execute `git clean -fdx` (default 0)')
def run_cmd(cmd):
print(f"Running: {cmd}")
result = subprocess.run(cmd, shell=True)
if result.returncode != 0:
print(f"Command failed: {cmd}", file=sys.stderr)
sys.exit(result.returncode)

build_options = parser.parse_args()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description='Process build options.')
parser.add_argument('--clean', action='store_true',
help='Execute `git clean -fdx`')
args = parser.parse_args()

if build_options.clean:
response = input("Warning: Executing `git clean -fdx` [Y/N]: ")
if response.lower() in ("y", "yes"):
os.system("git clean -fdx")
if args.clean:
response = input("Warning: Executing `git clean -fdx` [Y/N]: ")
if response.lower() in ("y", "yes"):
run_cmd("git clean -fdx")
else:
print("Skipping clean step.")

os.system("python scripts/build/add_dummy_submodules.py")
os.system("pip install -e . --verbose")
os.system("python scripts/build/delete_dummy_submodules.py")
os.system("pip install -e . --verbose --force-reinstall")
run_cmd("python scripts/build/add_dummy_submodules.py")
run_cmd("pip install -e . --verbose")
run_cmd("python scripts/build/delete_dummy_submodules.py")
run_cmd("pip install -e . --verbose --force-reinstall")
39 changes: 25 additions & 14 deletions scripts/build/install.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,29 @@
import os, argparse
import os
import argparse
import subprocess
import sys

parser = argparse.ArgumentParser(description='Process build options.')
parser.add_argument('--clean', type=bool, default=False,
help='Execute `git clean -fdx` (default 0)')
def run_cmd(cmd):
print(f"Running: {cmd}")
result = subprocess.run(cmd, shell=True)
if result.returncode != 0:
print(f"Command failed: {cmd}", file=sys.stderr)
sys.exit(result.returncode)

build_options = parser.parse_args()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description="Build and install pydatastructs.")
parser.add_argument("--clean", action="store_true", help="Execute `git clean -fdx`")
args = parser.parse_args()

if build_options.clean:
response = input("Warning: Executing `git clean -fdx` [Y/N]: ")
if response.lower() in ("y", "yes"):
os.system("git clean -fdx")
if args.clean:
response = input("Warning: Executing `git clean -fdx` [Y/N]: ")
if response.lower() in ("y", "yes"):
run_cmd("git clean -fdx")
else:
print("Skipping clean step.")

os.system("python scripts/build/add_dummy_submodules.py")
os.system("python setup.py build_ext --inplace")
os.system("pip install .")
os.system("python scripts/build/delete_dummy_submodules.py")
os.system("pip install . --force-reinstall")
run_cmd("python scripts/build/add_dummy_submodules.py")
run_cmd("python setup.py build_ext --inplace")
run_cmd("python -m pip install .")
run_cmd("python scripts/build/delete_dummy_submodules.py")
run_cmd("python -m pip install . --force-reinstall")
Loading