summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamie Slome <jamie@418sec.com>2021-03-25 06:57:33 +0000
committerGitHub <noreply@github.com>2021-03-25 06:57:33 +0000
commita05fc7931069e39b0194aaefcaa96014cb11f4d6 (patch)
treedb88c5b6c4b3dc973028dfa9fb382b8a1a22f490
parentd26e0f70d6c41bdb55a2ddc07d82c5de791b20f5 (diff)
downloadswig-a05fc7931069e39b0194aaefcaa96014cb11f4d6.tar.gz
Update mkdist.py
-rwxr-xr-xTools/mkdist.py24
1 files changed, 5 insertions, 19 deletions
diff --git a/Tools/mkdist.py b/Tools/mkdist.py
index 1a9d00be2..4fba4701d 100755
--- a/Tools/mkdist.py
+++ b/Tools/mkdist.py
@@ -3,29 +3,12 @@
import sys
import os
import subprocess
+from utils import *
def failed():
print("mkdist.py failed to complete")
sys.exit(2)
-def check_file_exists(path):
- """
- Checks if a file exists or not.
- """
- return os.path.isfile(path)
-
-def check_dir_exists(path):
- """
- Checks if a folder exists or not.
- """
- return os.path.isdir(path)
-
-def run_command(*args, **kwargs):
- """
- Runs an os command using subprocess module.
- """
- return subprocess.call(args, **kwargs)
-
import argparse
parser = argparse.ArgumentParser(description="Build a SWIG distribution tarball swig-x.y.z.tar.gz")
parser.add_argument("version", help="version string in format x.y.z")
@@ -44,8 +27,10 @@ skip_checks = args.skip_checks
toolsdir = os.path.dirname(os.path.abspath(__file__))
# Root directory path (swig) $ENV/swig
rootdir = os.path.abspath(os.path.join(toolsdir, os.pardir))
+# current directory
+current_dir = os.getcwd()
# version directory path $ENV/swig/<x.x.x>
-dirpath = os.path.join(rootdir, dirname)
+dirpath = os.path.join(current_dir, dirname)
if sys.version_info[0:2] < (2, 7):
print("Error: Python 2.7 or higher is required")
@@ -125,6 +110,7 @@ output = tar_ps.communicate()
# Go build the system
print("Building system")
+run_command("mkdir", "-p", dirpath)
run_command("./autogen.sh", cwd=dirpath) == 0 or failed()
cmdpath = os.path.join(dirpath, "Source", "CParse")