bcpkgfox 0.16.34__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.34
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,8 +59,9 @@ class cli:
59
59
 
60
60
  venv_group.add_argument(
61
61
  '-r', '--requirements',
62
- action='store_true',
63
- const='requirements.txt'
62
+ nargs='?',
63
+ action=self.venv_manager.custom_action_requirements,
64
+ default=False,
64
65
  help="Create a requirements\n"
65
66
  )
66
67
 
@@ -795,15 +796,26 @@ class cli:
795
796
  self.delete_venv()
796
797
  self.create_venv()
797
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
+
798
808
  def requirementes(self):
799
- if self.cli.args.requirements:
809
+ if isinstance(self.cli.args.requirements, bool):
800
810
  if '.' in self.cli.args.requirements:
801
811
  ext = self.cli.args.requirements.rsplit('.', 1)[1]
802
812
  else:
803
813
  ext = None
814
+
804
815
  try:
805
816
  os.remove(os.path.join(self.current_dir, self.cli.args.requirements))
806
817
  except:
818
+
807
819
  try:
808
820
  os.remove(os.path.join(self.current_dir, 'requirements.txt'))
809
821
  except:
@@ -811,6 +823,16 @@ class cli:
811
823
 
812
824
  subprocess.run("pip freeze > requirements.txt", shell=True)
813
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
+
814
836
  def main(self):
815
837
  try: self.delete_venv()
816
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.34
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.34",
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