bcpkgfox 0.16.35__tar.gz → 0.16.36__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.35
3
+ Version: 0.16.36
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -59,7 +59,9 @@ class cli:
59
59
 
60
60
  venv_group.add_argument(
61
61
  '-r', '--requirements',
62
- action='store_true',
62
+ nargs='?',
63
+ action=self.venv_manager.custom_action_requirements,
64
+ default=False,
63
65
  help="Create a requirements\n"
64
66
  )
65
67
 
@@ -794,15 +796,26 @@ class cli:
794
796
  self.delete_venv()
795
797
  self.create_venv()
796
798
 
799
+ class custom_action_requirements(argparse.Action):
800
+ ''' This is necessary to define a new action and the parser identifies it as valid '''
801
+
802
+ def __call__(self, parser, namespace, values, option_string=None):
803
+ if values is None:
804
+ setattr(namespace, self.dest, True)
805
+ else:
806
+ setattr(namespace, self.dest, values)
807
+
797
808
  def requirementes(self):
798
- if self.cli.args.requirements:
809
+ if isinstance(self.cli.args.requirements, bool):
799
810
  if '.' in self.cli.args.requirements:
800
811
  ext = self.cli.args.requirements.rsplit('.', 1)[1]
801
812
  else:
802
813
  ext = None
814
+
803
815
  try:
804
816
  os.remove(os.path.join(self.current_dir, self.cli.args.requirements))
805
817
  except:
818
+
806
819
  try:
807
820
  os.remove(os.path.join(self.current_dir, 'requirements.txt'))
808
821
  except:
@@ -810,6 +823,16 @@ class cli:
810
823
 
811
824
  subprocess.run("pip freeze > requirements.txt", shell=True)
812
825
 
826
+ with open('requirements.txt', 'r') as f:
827
+ lines = f.readlines()
828
+
829
+ imports = self.cli.find_import.main(return_=True)
830
+ imports_lower = {imp.lower() for imp in imports}
831
+ with open('requirements.txt', 'w') as f:
832
+ for line in lines:
833
+ if line.lower() in imports_lower:
834
+ f.write(line)
835
+
813
836
  def main(self):
814
837
  try: self.delete_venv()
815
838
  except: pass
@@ -253,5 +253,3 @@ class System:
253
253
  return estados[valor.upper()]
254
254
  estado_uf = {v.lower(): k for k, v in estados.items()}
255
255
  return estado_uf.get(valor.lower(), "Valor inválido")
256
-
257
-
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: bcpkgfox
3
- Version: 0.16.35
3
+ Version: 0.16.36
4
4
  Summary: Biblioteca BCFOX
5
5
  Home-page: https://github.com/robotsbcfox/PacotePythonBCFOX
6
6
  Author: Guilherme Neri
@@ -2,7 +2,7 @@ from setuptools import setup, find_packages
2
2
 
3
3
  setup(
4
4
  name="bcpkgfox",
5
- version="0.16.35",
5
+ version="0.16.36",
6
6
  author="Guilherme Neri",
7
7
  author_email="guilherme.neri@bcfox.com.br",
8
8
  description="Biblioteca BCFOX",
File without changes
File without changes
File without changes