29
29
30
30
from pythonforandroid import __version__
31
31
from pythonforandroid .bootstrap import Bootstrap
32
- from pythonforandroid .build import Context , build_recipes
32
+ from pythonforandroid .build import Context , build_recipes , project_has_setup_py
33
33
from pythonforandroid .distribution import Distribution , pretty_log_dists
34
34
from pythonforandroid .entrypoints import main
35
35
from pythonforandroid .graph import get_recipe_order_and_bootstrap
@@ -569,18 +569,18 @@ def add_parser(subparsers, *args, **kwargs):
569
569
args , unknown = parser .parse_known_args (sys .argv [1 :])
570
570
args .unknown_args = unknown
571
571
572
- if hasattr (args , "private" ) and args . private is not None :
572
+ if getattr (args , "private" , None ) is not None :
573
573
# Pass this value on to the internal bootstrap build.py:
574
574
args .unknown_args += ["--private" , args .private ]
575
- if hasattr (args , "build_mode" ) and args . build_mode == "release" :
575
+ if getattr (args , "build_mode" , None ) == "release" :
576
576
args .unknown_args += ["--release" ]
577
- if hasattr (args , "with_debug_symbols" ) and args . with_debug_symbols :
577
+ if getattr (args , "with_debug_symbols" , False ) :
578
578
args .unknown_args += ["--with-debug-symbols" ]
579
- if hasattr (args , "ignore_setup_py" ) and args . ignore_setup_py :
579
+ if getattr (args , "ignore_setup_py" , False ) :
580
580
args .use_setup_py = False
581
- if hasattr (args , "activity_class_name" ) and args . activity_class_name != 'org.kivy.android.PythonActivity' :
581
+ if getattr (args , "activity_class_name" , "org.kivy.android.PythonActivity" ) != 'org.kivy.android.PythonActivity' :
582
582
args .unknown_args += ["--activity-class-name" , args .activity_class_name ]
583
- if hasattr (args , "service_class_name" ) and args . service_class_name != 'org.kivy.android.PythonService' :
583
+ if getattr (args , "service_class_name" , "org.kivy.android.PythonService" ) != 'org.kivy.android.PythonService' :
584
584
args .unknown_args += ["--service-class-name" , args .service_class_name ]
585
585
586
586
self .args = args
@@ -603,21 +603,13 @@ def add_parser(subparsers, *args, **kwargs):
603
603
args , "with_debug_symbols" , False
604
604
)
605
605
606
- have_setup_py_or_similar = False
607
- if getattr (args , "private" , None ) is not None :
608
- project_dir = getattr (args , "private" )
609
- if (os .path .exists (os .path .join (project_dir , "setup.py" )) or
610
- os .path .exists (os .path .join (project_dir ,
611
- "pyproject.toml" ))):
612
- have_setup_py_or_similar = True
613
-
614
606
# Process requirements and put version in environ
615
607
if hasattr (args , 'requirements' ):
616
608
requirements = []
617
609
618
610
# Add dependencies from setup.py, but only if they are recipes
619
611
# (because otherwise, setup.py itself will install them later)
620
- if (have_setup_py_or_similar and
612
+ if (project_has_setup_py ( getattr ( args , "private" , None )) and
621
613
getattr (args , "use_setup_py" , False )):
622
614
try :
623
615
info ("Analyzing package dependencies. MAY TAKE A WHILE." )
@@ -698,10 +690,7 @@ def warn_on_deprecated_args(self, args):
698
690
699
691
# Output warning if setup.py is present and neither --ignore-setup-py
700
692
# nor --use-setup-py was specified.
701
- if getattr (args , "private" , None ) is not None and \
702
- (os .path .exists (os .path .join (args .private , "setup.py" )) or
703
- os .path .exists (os .path .join (args .private , "pyproject.toml" ))
704
- ):
693
+ if project_has_setup_py (getattr (args , "private" , None )):
705
694
if not getattr (args , "use_setup_py" , False ) and \
706
695
not getattr (args , "ignore_setup_py" , False ):
707
696
warning (" **** FUTURE BEHAVIOR CHANGE WARNING ****" )
0 commit comments