Skip to content

Commit 44f176e

Browse files
Fixed th bug of the private_account when not run from the file itself.
Added __init__ for module
1 parent 21bb5cf commit 44f176e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

AndroidXMigration/__init__.py

Whitespace-only changes.

git_management/__init__.py

Whitespace-only changes.

git_management/git_init.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,19 @@
22
# https://github.com/gitpython-developers/GitPython/blob/master/git/test/test_docs.py
33
# https://github.com/PyGithub/PyGithub
44
import os
5+
from os import path
56
import subprocess
67
from shutil import copyfile
78
import git
89
from git import Actor
910
from git import Repo
1011
from github import Github
11-
import sh_command
12+
import git_management
13+
from git_management import sh_command
1214
from ownStyle import GREEN, BLUE, BOLD, GREEN, RED, RESET, CYAN
1315
#Managing private account : the file git_private_account.py is not in git
14-
import importlib
15-
privateAccount = importlib.util.find_spec("git_private_account")
16-
if privateAccount is not None:
16+
ROOT_PYTHON_PATH=path.dirname(path.abspath(__file__))
17+
if os.path.isfile(ROOT_PYTHON_PATH+'\\git_private_account.py'):
1718
import git_private_account
1819
print(GREEN+" Private accounts for jenkins have been found. Using them.")
1920
githubAccessToken = git_private_account.githubAccessToken
@@ -164,5 +165,6 @@ def gitCreateAndPush(repository,repoDescription):
164165
sh_command.runGitPushInCommandLine(repository)
165166

166167

168+
167169
# print('test')
168170
# listGitHubRepo()

gradle_management/__init__.py

Whitespace-only changes.

jenkins_management/jenkinsTools.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
JENKINS_TEMPLATE_PATH=ROOT_PYTHON_PATH+"\\templates\\"
1111

1212
#Managing private account : the file jenkins_private_account.py is not in git
13-
import importlib
14-
privateAccount = importlib.util.find_spec("jenkins_private_account")
15-
if privateAccount is not None:
13+
if path.isfile(ROOT_PYTHON_PATH+'\\jenkins_private_account.py'):
1614
import jenkins_private_account
1715
print(GREEN+" Private accounts for jenkins have been found. Using them.")
1816
GIT_ROOT_URL=jenkins_private_account.GIT_ROOT_URL
@@ -142,4 +140,4 @@ def createLinkedJobs(jenkinsJobs):
142140

143141
# createJob("MultiplicationBasile","master","clean build")
144142
# listJobs()
145-
# print("Test")
143+
print("Test")

0 commit comments

Comments
 (0)