From 44f176ed9d616d443fd947a9b88e952b045567f4 Mon Sep 17 00:00:00 2001 From: MathiasSeguy-Android2EE Date: Wed, 5 Jun 2019 11:31:18 +0200 Subject: [PATCH] Fixed th bug of the private_account when not run from the file itself. Added __init__ for module --- AndroidXMigration/__init__.py | 0 git_management/__init__.py | 0 git_management/git_init.py | 10 ++++++---- gradle_management/__init__.py | 0 jenkins_management/jenkinsTools.py | 6 ++---- 5 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 AndroidXMigration/__init__.py create mode 100644 git_management/__init__.py create mode 100644 gradle_management/__init__.py diff --git a/AndroidXMigration/__init__.py b/AndroidXMigration/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/git_management/__init__.py b/git_management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/git_management/git_init.py b/git_management/git_init.py index bdb7988..3222d7a 100644 --- a/git_management/git_init.py +++ b/git_management/git_init.py @@ -2,18 +2,19 @@ # https://github.com/gitpython-developers/GitPython/blob/master/git/test/test_docs.py # https://github.com/PyGithub/PyGithub import os +from os import path import subprocess from shutil import copyfile import git from git import Actor from git import Repo from github import Github -import sh_command +import git_management +from git_management import sh_command from ownStyle import GREEN, BLUE, BOLD, GREEN, RED, RESET, CYAN #Managing private account : the file git_private_account.py is not in git -import importlib -privateAccount = importlib.util.find_spec("git_private_account") -if privateAccount is not None: +ROOT_PYTHON_PATH=path.dirname(path.abspath(__file__)) +if os.path.isfile(ROOT_PYTHON_PATH+'\\git_private_account.py'): import git_private_account print(GREEN+" Private accounts for jenkins have been found. Using them.") githubAccessToken = git_private_account.githubAccessToken @@ -164,5 +165,6 @@ def gitCreateAndPush(repository,repoDescription): sh_command.runGitPushInCommandLine(repository) + # print('test') # listGitHubRepo() \ No newline at end of file diff --git a/gradle_management/__init__.py b/gradle_management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/jenkins_management/jenkinsTools.py b/jenkins_management/jenkinsTools.py index aea5bc3..029f8a1 100644 --- a/jenkins_management/jenkinsTools.py +++ b/jenkins_management/jenkinsTools.py @@ -10,9 +10,7 @@ JENKINS_TEMPLATE_PATH=ROOT_PYTHON_PATH+"\\templates\\" #Managing private account : the file jenkins_private_account.py is not in git -import importlib -privateAccount = importlib.util.find_spec("jenkins_private_account") -if privateAccount is not None: +if path.isfile(ROOT_PYTHON_PATH+'\\jenkins_private_account.py'): import jenkins_private_account print(GREEN+" Private accounts for jenkins have been found. Using them.") GIT_ROOT_URL=jenkins_private_account.GIT_ROOT_URL @@ -142,4 +140,4 @@ def createLinkedJobs(jenkinsJobs): # createJob("MultiplicationBasile","master","clean build") # listJobs() -# print("Test") \ No newline at end of file +print("Test") \ No newline at end of file