Changeset 212


Ignore:
Timestamp:
03/23/11 23:00:16 (13 years ago)
Author:
tim
Message:

fixed python2 compatbility problems in pyregfi
added better install scripts for both python2 and python3

Location:
trunk
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SConstruct

    r211 r212  
    11import sys
    2 import distutils.sysconfig
     2import os
     3#import distutils.sysconfig
    34
    45#cflags = '-std=gnu99 -pedantic -Wall'
     
    4142man_reglookup_timeline = env.ManPage('doc/reglookup-timeline.1.docbook')
    4243
    43 
    4444# Installation
    4545prefix='/usr/local/'
     46install_items = [prefix+'bin',
     47                 prefix+'lib',
     48                 prefix+'include/regfi',
     49                 prefix+'man']
     50
    4651env.Install(prefix+'bin', [reglookup, reglookup_recover, 'bin/reglookup-timeline'])
    4752env.Install(prefix+'lib', [libregfi, libregfi_static])
    48 env.Install(distutils.sysconfig.get_python_lib()+'/pyregfi', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'])
    4953env.Install(prefix+'include/regfi', Glob('include/*.h'))
    5054env.Install(prefix+'man/man1', [man_reglookup, man_reglookup_recover,
    5155                                man_reglookup_timeline])
    5256
    53 # Could do this instead, but not sure how to ensure cleanup afterward.
    54 #from distutils.core import setup
    55 #setup(name='pyregfi', version='0.1', package_dir={'':'python'}, packages=['pyregfi'])
     57if sys.version_info[0] == 2:
     58   install_items.append('pyregfi2-install.log')
     59   env.Command('pyregfi2-install.log', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'],
     60               "python pyregfi-distutils.py install | tee pyregfi2-install.log")
     61
     62python_path = os.popen('which python3').read()
     63if python_path != '':
     64   install_items.append('pyregfi3-install.log')
     65   env.Command('pyregfi3-install.log', ['python/pyregfi/__init__.py', 'python/pyregfi/structures.py'],
     66               "python3 pyregfi-distutils.py install | tee pyregfi3-install.log")
     67
    5668
    5769# User Friendly Targets
    5870env.Alias('libregfi', libregfi)
    59 env.Alias('pyregfi', distutils.sysconfig.get_python_lib()+'/pyregfi')
    6071env.Alias('reglookup', reglookup)
    6172env.Alias('reglookup-recover', reglookup_recover)
    6273env.Alias('bin', [reglookup_recover, reglookup])
    6374env.Alias('doc', [man_reglookup,man_reglookup_recover,man_reglookup_timeline])
    64 env.Alias('install', [prefix+'bin',
    65                       prefix+'lib',
    66                       prefix+'include/regfi',
    67                       distutils.sysconfig.get_python_lib()+'/pyregfi',
    68                       prefix+'man'])
     75env.Alias('install', install_items)
    6976
    7077Default('bin', libregfi)
  • trunk/python/pyregfi/__init__.py

    r210 r212  
    149149## Abstract class which Handles memory management and proxies attribute
    150150#  access to base structures 
    151 class _StructureWrapper():
     151class _StructureWrapper(object):
    152152
    153153    hive = None
     
    187187
    188188
    189 class _GenericList():
     189class _GenericList(object):
    190190    hive = None
    191191    key = None
     
    241241        return self.constructor(self.hive, elem)
    242242   
     243    # For Python 2.x
     244    def next(self):
     245        return self.__next__()
     246
    243247
    244248class _SubkeyList(_GenericList):
     
    457461        return self.current_key()
    458462
     463    # For Python 2.x
     464    def next(self):
     465        return self.__next__()
     466
    459467    def down(self):
    460468        pass
Note: See TracChangeset for help on using the changeset viewer.