[Python-checkins] python/nondist/sandbox/setuptools/setuptools/command __init__.py, 1.1, 1.2 build_py.py, 1.1, 1.2 depends.py, 1.3, 1.4

fdrake at users.sourceforge.net fdrake at users.sourceforge.net
Mon Apr 5 16:21:56 EDT 2004


Update of /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7751/setuptools/command

Modified Files:
	__init__.py build_py.py depends.py 
Log Message:
remove excess blank lines, and apply whitespace more in line with the Python
style guidelines in PEP 8


Index: __init__.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/__init__.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** __init__.py	19 Mar 2004 20:53:14 -0000	1.1
--- __init__.py	5 Apr 2004 20:21:53 -0000	1.2
***************
*** 9,11 ****
  distutils.command.__all__.extend(
      [cmd for cmd in __all__ if cmd not in distutils.command.__all__]
! )
--- 9,11 ----
  distutils.command.__all__.extend(
      [cmd for cmd in __all__ if cmd not in distutils.command.__all__]
!     )

Index: build_py.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/build_py.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** build_py.py	19 Mar 2004 20:53:14 -0000	1.1
--- build_py.py	5 Apr 2004 20:21:53 -0000	1.2
***************
*** 1,9 ****
  from distutils.command.build_py import build_py as _build_py
  from distutils.util import convert_path
  from glob import glob
- import os.path
  
- class build_py(_build_py):
  
      """Enhanced 'build_py' command that includes data files with packages
  
--- 1,10 ----
+ import os.path
+ 
  from distutils.command.build_py import build_py as _build_py
  from distutils.util import convert_path
  from glob import glob
  
  
+ class build_py(_build_py):
      """Enhanced 'build_py' command that includes data files with packages
  
***************
*** 18,28 ****
          _build_py.finalize_options(self)
          self.package_data = self.distribution.package_data
!         self.data_files   = self.get_data_files()
! 
  
      def run(self):
- 
          """Build modules, packages, and copy data files to build directory"""
- 
          if not self.py_modules and not self.packages:
              return
--- 19,26 ----
          _build_py.finalize_options(self)
          self.package_data = self.distribution.package_data
!         self.data_files = self.get_data_files()
  
      def run(self):
          """Build modules, packages, and copy data files to build directory"""
          if not self.py_modules and not self.packages:
              return
***************
*** 37,49 ****
          # Only compile actual .py files, using our base class' idea of what our
          # output files are.
!         self.byte_compile(_build_py.get_outputs(self,include_bytecode=0))
! 
  
      def get_data_files(self):
- 
          """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
- 
          data = []
- 
          for package in self.packages:
              # Locate package source directory
--- 35,43 ----
          # Only compile actual .py files, using our base class' idea of what our
          # output files are.
!         self.byte_compile(_build_py.get_outputs(self, include_bytecode=0))
  
      def get_data_files(self):
          """Generate list of '(package,src_dir,build_dir,filenames)' tuples"""
          data = []
          for package in self.packages:
              # Locate package source directory
***************
*** 51,55 ****
  
              # Compute package build directory
!             build_dir = os.path.join(*([self.build_lib]+package.split('.')))
  
              # Length of path to strip from found files
--- 45,49 ----
  
              # Compute package build directory
!             build_dir = os.path.join(*([self.build_lib] + package.split('.')))
  
              # Length of path to strip from found files
***************
*** 59,100 ****
              filenames = [
                  file[plen:] for file in self.find_data_files(package, src_dir)
!             ]
! 
              data.append( (package, src_dir, build_dir, filenames) )
- 
          return data
  
- 
      def find_data_files(self, package, src_dir):
- 
          """Return filenames for package's data files in 'src_dir'"""
! 
!         globs = self.package_data.get('',[])+self.package_data.get(package,[])
          files = []
- 
          for pattern in globs:
              # Each pattern has to be converted to a platform-specific path
              files.extend(glob(os.path.join(src_dir, convert_path(pattern))))
- 
          return files
  
- 
- 
      def build_package_data(self):
- 
          """Copy data files into build directory"""
- 
          lastdir = None
- 
          for package, src_dir, build_dir, filenames in self.data_files:
- 
              for filename in filenames:
!                 target = os.path.join(build_dir,filename)
                  self.mkpath(os.path.dirname(target))
!                 self.copy_file(os.path.join(src_dir,filename), target)
! 
  
      def get_outputs(self, include_bytecode=1):
- 
          """Return complete list of files copied to the build directory
  
--- 53,80 ----
              filenames = [
                  file[plen:] for file in self.find_data_files(package, src_dir)
!                 ]
              data.append( (package, src_dir, build_dir, filenames) )
          return data
  
      def find_data_files(self, package, src_dir):
          """Return filenames for package's data files in 'src_dir'"""
!         globs = (self.package_data.get('', [])
!                  + self.package_data.get(package, []))
          files = []
          for pattern in globs:
              # Each pattern has to be converted to a platform-specific path
              files.extend(glob(os.path.join(src_dir, convert_path(pattern))))
          return files
  
      def build_package_data(self):
          """Copy data files into build directory"""
          lastdir = None
          for package, src_dir, build_dir, filenames in self.data_files:
              for filename in filenames:
!                 target = os.path.join(build_dir, filename)
                  self.mkpath(os.path.dirname(target))
!                 self.copy_file(os.path.join(src_dir, filename), target)
  
      def get_outputs(self, include_bytecode=1):
          """Return complete list of files copied to the build directory
  
***************
*** 104,123 ****
          correct installation manifest.)
          """
! 
!         return _build_py.get_outputs(self,include_bytecode) + [
!             os.path.join(build_dir,filename)
!                 for package,src_dir,build_dir,filenames in self.data_files
!                     for filename in filenames
!         ]
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
! 
--- 84,90 ----
          correct installation manifest.)
          """
!         return _build_py.get_outputs(self, include_bytecode) + [
!             os.path.join(build_dir, filename)
!             for package, src_dir, build_dir,filenames in self.data_files
!             for filename in filenames
!             ]

Index: depends.py
===================================================================
RCS file: /cvsroot/python/python/nondist/sandbox/setuptools/setuptools/command/depends.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** depends.py	22 Mar 2004 01:12:31 -0000	1.3
--- depends.py	5 Apr 2004 20:21:53 -0000	1.4
***************
*** 1,8 ****
  from distutils.cmd import Command
- import os, sys
  
  
  class depends(Command):
- 
      """Download and install dependencies, if needed"""
  
--- 1,9 ----
+ import os
+ import sys
+ 
  from distutils.cmd import Command
  
  
  class depends(Command):
      """Download and install dependencies, if needed"""
  
***************
*** 14,39 ****
          ('ignore-extra-args', 'i',
           "ignore options that won't be passed to child setup scripts"),
!     ]
  
      path_attrs = [
          # Note: these must be in *reverse* order, as they are pushed onto the
          # *front* of a copy of sys.path.
!         ('install','install_libbase'),      # installation base if extra_path
!         ('install_lib','install_dir'),      # where modules are installed
!     ]
  
      # Command options that can be safely passed to dependencies' setup scripts
      safe_opts = {
          'install': [
!             'prefix','exec-prefix','home','install-base','install-platbase',
!             'root','optimize','force','verbose','quiet'
!         ],
!         'build': ['compiler','debug','force','verbose','quiet'],
!     }
  
      # Options with string arguments that are *not* directories or files, and
      # so should *not* have absolute-path fixups applied.
!     non_fs_opts = {'build':['compiler'] }
! 
  
      def initialize_options(self):
--- 15,39 ----
          ('ignore-extra-args', 'i',
           "ignore options that won't be passed to child setup scripts"),
!         ]
  
      path_attrs = [
          # Note: these must be in *reverse* order, as they are pushed onto the
          # *front* of a copy of sys.path.
!         ('install', 'install_libbase'),     # installation base if extra_path
!         ('install_lib', 'install_dir'),     # where modules are installed
!         ]
  
      # Command options that can be safely passed to dependencies' setup scripts
      safe_opts = {
          'install': [
!             'prefix', 'exec-prefix', 'home', 'install-base',
!             'install-platbase', 'root', 'optimize', 'force', 'verbose', 'quiet'
!             ],
!         'build': ['compiler', 'debug', 'force', 'verbose', 'quiet'],
!         }
  
      # Options with string arguments that are *not* directories or files, and
      # so should *not* have absolute-path fixups applied.
!     non_fs_opts = {'build': ['compiler']}
  
      def initialize_options(self):
***************
*** 86,90 ****
          needed = [
              dep for dep in self.distribution.requires if self.is_needed(dep)
!         ]
  
          if not needed:
--- 86,90 ----
          needed = [
              dep for dep in self.distribution.requires if self.is_needed(dep)
!             ]
  
          if not needed:
***************
*** 98,102 ****
          self.announce(
              "dependencies will be installed using:\n    "+' '.join(argv)+'\n'
!         )
  
          # Alert for unsupported commands/options, unless '-i' was used
--- 98,102 ----
          self.announce(
              "dependencies will be installed using:\n    "+' '.join(argv)+'\n'
!             )
  
          # Alert for unsupported commands/options, unless '-i' was used
***************
*** 110,125 ****
                      " to omit the unsupported options,\nor install the"
                      " dependencies manually."
!                 )
! 
  
          # Alert the user to missing items
          fmt = "\t%s\t%s\n"
!         items = [fmt % (dep.full_name(),dep.homepage) for dep in needed]
          items.insert(0,"Please install the following packages *first*:\n")
          items.append('')
          raise SystemExit('\n'.join(items))  # dump msg to stderr and exit
  
- 
- 
      def warn_unsafe_options_used(self):
          lines = []; write = lines.append
--- 110,122 ----
                      " to omit the unsupported options,\nor install the"
                      " dependencies manually."
!                     )
  
          # Alert the user to missing items
          fmt = "\t%s\t%s\n"
!         items = [fmt % (dep.full_name(), dep.homepage) for dep in needed]
          items.insert(0,"Please install the following packages *first*:\n")
          items.append('')
          raise SystemExit('\n'.join(items))  # dump msg to stderr and exit
  
      def warn_unsafe_options_used(self):
          lines = []; write = lines.append
***************
*** 127,138 ****
          write("dependencies, and will be IGNORED:")
          for cmd,line in self.unsafe_options.items():
!             write('\t%s %s' % (cmd,' '.join(line)))
          write('')
          self.warn('\n'.join(lines))
  
- 
      def is_needed(self,dep):
          """Does the specified dependency need to be installed/updated?"""
- 
          self.announce("searching for "+dep.full_name())
          version = dep.get_version(self.search_path)
--- 124,133 ----
          write("dependencies, and will be IGNORED:")
          for cmd,line in self.unsafe_options.items():
!             write('\t%s %s' % (cmd, ' '.join(line)))
          write('')
          self.warn('\n'.join(lines))
  
      def is_needed(self,dep):
          """Does the specified dependency need to be installed/updated?"""
          self.announce("searching for "+dep.full_name())
          version = dep.get_version(self.search_path)
***************
*** 153,164 ****
              self.announce(status+" (update needed)")
              return True
- 
- 
- 
- 
- 
- 
- 
- 
- 
- 
--- 148,149 ----




More information about the Python-checkins mailing list