Beispiel #1
0
  def post(self):
    user_secret = self.request.get('user_secret')
    try:
      user = users.get_current_user()
      user_id = user.user_id()
    except:
      user_id = None

    series = self.request.get('series')
    value = float(self.request.get('value'))
    timestamp = self.request.get('timestamp')
    timems = self.request.get('timems')
    if not timestamp or timestamp == 'None' or timestamp == '':
      if timems and timems != '':
        timeSeconds = float(timems) / 1000
        timestamp = datetime.datetime.utcfromtimestamp(timeSeconds)
      else:
        timestamp = datetime.datetime.now()
    else:
      # kberg asks: IS THIS RIGHT?
      timestamp = datetime.strptime('%Y/%m/%d %H:%M:%S')
    data.add(name=series, value=value, timestamp=timestamp, user_id=user_id,
        secret=user_secret)
    self.response.out.write('Added: %s, %s, %s\n' % (
      series, value, timestamp))
Beispiel #2
0
  def get(self):
   self.response.out.write('adding random data.')
   now = datetime.datetime.now()
   user = users.get_current_user()
   user_id = user.user_id()
   sys.stderr.write('User id: %s\n' % user_id)
   for i in range(3):

     # add a few in last hour, day, week, month, year.
     hour_secs = 60*60
     day_secs = 24*hour_secs
     week_secs = 7*day_secs
     month_secs = 30*day_secs
     year_secs = 365*day_secs

     for ago in (hour_secs, day_secs, week_secs, month_secs, year_secs):
       timestamp = now - datetime.timedelta(seconds=ago)
       data.add(name='first',
           value=float(random.randint(0, 100)),
           user_id=user_id,
           timestamp=timestamp)
       data.add(name='second',
           value=float(random.randint(0, 100)),
           user_id=user_id,
           timestamp=timestamp)
Beispiel #3
0
Datei: push.py Projekt: mote/dviz
 def bulk_add(self, payload, series, user_id, user_secret):
   total = 0
   for item in payload.split('\n'):
     total += 1
     time_seconds, value = item.split(' ')
     timestamp = util.from_seconds(time_seconds)
     value = float(value)
     data.add(name=series, value=value, timestamp=timestamp, user_id=user_id,
         secret=user_secret)
   return 'Added %d items to %s' % (total, series)
Beispiel #4
0
Datei: push.py Projekt: mote/dviz
 def single_add(self, timestamp_str, timems, series, value, user_id,
     user_secret):
   if not util.has_value(timestamp_str):
     if util.has_value(timems):
       time_seconds = float(timems) / 1000
       timestamp = util.from_seconds(time_seconds)
     else:
       timestamp = datetime.datetime.now()
   else:
     timestamp = util.parse_time(timestamp_str)
   data.add(name=series, value=value, timestamp=timestamp, user_id=user_id,
       secret=user_secret)
   return 'Added: %s, %s, %s\n' % (series, value, timestamp)
Beispiel #5
0
def clone_env(env):
    ret= env.Clone(CXXFLAGS= copy.deepcopy(env.get("CXXFLAGS", [])),
                     CPPFLAGS= copy.deepcopy(env.get("CPPFLAGS", [])),
                     CPPDEFINES= copy.deepcopy(env.get("CPPDEFINES", [])),
                     LDMODULEFLAGS= copy.deepcopy(env.get("LDMODULEFLAGS", [])),
                     LDMODULEPREFIX= copy.deepcopy(env.get("LDMODULEPREFIX", "")),
                     SHLIBPREFIX= copy.deepcopy(env.get("SHLIBPREFIX", "")),
                     SCANNERS= [x for x in env.get("SCANNERS", [])],
                     LDMODULESUFFIX= copy.deepcopy(env.get("LDMODULESUFFIX", "")),
                     SHLIBSUFFIX= copy.deepcopy(env.get("SHLIBSUFFIX", "")))
    # just in case scons fixes the bug
    data.add(ret, data.get(env))
    return ret
	def addItem(self):
		print "Add Item"
		if self.id.get():
			tkMessageBox.showinfo('Notice','This is a exust report,\nPlease clean it and try again.')
			return False
		if self.isstatus() is False:
			self.status.focus_set()
			return False
		if self.issize() is False:
			self.size.focus_set()
			return False
		if self.isqty() is False:
			self.getqty.focus_set()
			return False
		if self.istype() is False:
			self.type.focus_set()
			return False
		if self.isfromL() is False:
			self.fromL.focus_set()
			return False
		if self.istoL() is False:
			self.toL.focus_set()
			return False

		issue_status=self.isvalue(self.status.get())
		issue_from=self.isvalue(self.fromL.get())
		issue_to=self.isvalue(self.toL.get())
		issue_date=self.isvalue(self.date.get())
		issue_size=self.isvalue(self.size.get())
		issue_product=self.isvalue(self.product.get())
		issue_qty=self.isvalue(self.qty.get())
		issue_type=self.isvalue(self.type.get())
		remarks=self.isvalue(self.remark.get(1.0,END))
		create_by=self.username
		create_date=datetime.datetime.now().strftime('%Y/%m/%d-%H%M')

		add_list=[issue_status,issue_from,issue_to,issue_date,issue_type,issue_size,issue_qty,issue_product,remarks,create_by,create_date]
		a=data.add('safety_shoes',add_list)
		if a:
			tkMessageBox.showinfo('Notice','Add Success.')
			self.clearItem()
			self.get_item_list()
			self.id.set('')
			self.get_first_page()
			self.status.focus_set()
		else:
			tkMessageBox.showinfo('Notice','please try again.')
			self.status.focus_set()
			return False
	def addItem(self):
		if self.id.get():
			tkMessageBox.showinfo('Notice','Please try again.')
			return
		if not self.isstatus():
			self.status.focus_set()
			return False
		if not self.issize():
			self.size.focus_set()
			return False
		if not self.isqty():
			self.getqty.focus_set()
			return False
		issue_status=self.isvalue(self.status.get())
		issue_from=self.isvalue(self.fromL.get())
		issue_to=self.isvalue(self.toL.get())
		issue_date=self.isvalue(self.date.get())
		size=self.isvalue(self.size.get())
		product_name=self.isvalue(self.product.get())
		qty=self.isvalue(self.qty.get())
		remarks=self.isvalue(self.remark.get(1.0,END))
		create_by=self.user
		create_date=datetime.datetime.now().strftime('%Y%m%d-%MH%M')

		add_list=[issue_from,issue_to,product_name,size,qty,issue_date,issue_status,remarks,create_by,create_date]
		a=data.add(add_list)
		if a:
			tkMessageBox.showinfo('Notice','Add Success.')
			self.clearItem()
			self.id.set('')
			self.get_first_page()
			self.status.focus_set()
		else:
			tkMessageBox.showinfo('Notice','please try again.')
			self.status.focus_set()
			return
Beispiel #8
0
    def __init__(self, view):
        JPanel.__init__(self)
        self.view = view
        self.background = Color.white
        self.config_panel_height = 60

        mainPanel = JPanel(background=self.background, layout=BorderLayout())
        mainPanel.border = RoundedBorder()
        configPanel = JPanel(background=self.background, visible=False)

        self.layout = BorderLayout()
        self.add(mainPanel, BorderLayout.NORTH)
        self.add(configPanel, BorderLayout.SOUTH)

        self.config_button = JButton(Icon.arrowdown,
                                     rolloverIcon=ShadedIcon.arrowdown,
                                     toolTipText='configure',
                                     actionPerformed=self.configure,
                                     borderPainted=False,
                                     focusPainted=False,
                                     contentAreaFilled=False)
        self.add(self.config_button)

        self.configPanel = configPanel

        self.slider = JSlider(0, 1, 0, background=self.background)
        self.slider.snapToTicks = True
        mainPanel.add(self.slider)
        self.slider.addChangeListener(self)

        self.min_time = JLabel(' 0.0000 ',
                               opaque=True,
                               background=self.background)
        self.max_time = JLabel(' 0.0000 ',
                               opaque=True,
                               background=self.background)

        self.left_panel = JPanel(background=self.background)
        self.left_panel.add(
            JButton(Icon.restart,
                    rolloverIcon=ShadedIcon.restart,
                    toolTipText='restart',
                    actionPerformed=self.start,
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False))
        self.left_panel.add(self.min_time)
        self.left_panel.add(
            JButton(icon=Icon.start,
                    rolloverIcon=ShadedIcon.start,
                    toolTipText='jump to beginning',
                    actionPerformed=lambda x: self.slider.setValue(self.slider.
                                                                   minimum),
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False))

        self.right_panel = JPanel(background=self.background)
        self.right_panel.add(
            JButton(icon=Icon.end,
                    rolloverIcon=ShadedIcon.end,
                    toolTipText='jump to end',
                    actionPerformed=lambda x: self.slider.setValue(self.slider.
                                                                   maximum),
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False))
        self.right_panel.add(self.max_time)
        self.playpause_button = JButton(Icon.play,
                                        actionPerformed=self.pause,
                                        rolloverIcon=ShadedIcon.play,
                                        toolTipText='continue',
                                        borderPainted=False,
                                        focusPainted=False,
                                        contentAreaFilled=False)
        self.right_panel.add(self.playpause_button)

        mainPanel.add(self.left_panel, BorderLayout.WEST)
        mainPanel.add(self.right_panel, BorderLayout.EAST)

        pdf = JPanel(layout=BorderLayout(), opaque=False)
        pdf.add(
            JButton(Icon.pdf,
                    rolloverIcon=ShadedIcon.pdf,
                    toolTipText='save pdf',
                    actionPerformed=self.save_pdf,
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False))
        pdf.add(
            JLabel('pdf',
                   horizontalAlignment=javax.swing.SwingConstants.CENTER),
            BorderLayout.NORTH)
        pdf.maximumSize = pdf.preferredSize
        configPanel.add(pdf)

        data = JPanel(layout=BorderLayout(), opaque=False)
        data.add(
            JButton(Icon.data,
                    rolloverIcon=ShadedIcon.data,
                    toolTipText='examine data',
                    actionPerformed=self.show_data,
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False))
        data.add(
            JLabel('data',
                   horizontalAlignment=javax.swing.SwingConstants.CENTER),
            BorderLayout.NORTH)
        data.maximumSize = data.preferredSize
        configPanel.add(data)

        mode = JPanel(layout=BorderLayout(), opaque=False)
        cb = JComboBox(['default', 'rate', 'direct'])
        if self.view.network.mode in [
                SimulationMode.DEFAULT, SimulationMode.PRECISE
        ]:
            cb.setSelectedIndex(0)
        elif self.view.network.mode in [SimulationMode.RATE]:
            cb.setSelectedIndex(1)
        elif self.view.network.mode in [
                SimulationMode.DIRECT, SimulationMode.APPROXIMATE
        ]:
            cb.setSelectedIndex(2)
        cb.addActionListener(self)
        self.mode_combobox = cb
        mode.add(cb)
        mode.add(JLabel('mode'), BorderLayout.NORTH)
        mode.maximumSize = mode.preferredSize
        configPanel.add(mode)

        dt = JPanel(layout=BorderLayout(), opaque=False)
        cb = JComboBox(['0.001', '0.0005', '0.0002', '0.0001'])
        cb.setSelectedIndex(0)
        self.view.dt = float(cb.getSelectedItem())
        cb.addActionListener(self)
        self.dt_combobox = cb
        dt.add(cb)
        dt.add(JLabel('time step'), BorderLayout.NORTH)
        dt.maximumSize = dt.preferredSize
        configPanel.add(dt)

        rate = JPanel(layout=BorderLayout(), opaque=False)
        self.rate_combobox = JComboBox([
            'fastest', '1x', '0.5x', '0.2x', '0.1x', '0.05x', '0.02x', '0.01x',
            '0.005x', '0.002x', '0.001x'
        ])
        self.rate_combobox.setSelectedIndex(4)
        self.view.set_target_rate(self.rate_combobox.getSelectedItem())
        self.rate_combobox.addActionListener(self)
        rate.add(self.rate_combobox)
        rate.add(JLabel('speed'), BorderLayout.NORTH)
        rate.maximumSize = rate.preferredSize
        configPanel.add(rate)

        spin1 = JPanel(layout=BorderLayout(), opaque=False)
        self.record_time_spinner = JSpinner(SpinnerNumberModel(
            (self.view.timelog.tick_limit - 1) * self.view.dt, 0.1, 100, 1),
                                            stateChanged=self.tick_limit)
        spin1.add(self.record_time_spinner)
        spin1.add(JLabel('recording time'), BorderLayout.NORTH)
        spin1.maximumSize = spin1.preferredSize
        configPanel.add(spin1)

        spin2 = JPanel(layout=BorderLayout(), opaque=False)
        self.filter_spinner = JSpinner(SpinnerNumberModel(
            self.view.tau_filter, 0, 0.5, 0.01),
                                       stateChanged=self.tau_filter)
        spin2.add(self.filter_spinner)
        spin2.add(JLabel('filter'), BorderLayout.NORTH)
        spin2.maximumSize = spin2.preferredSize
        configPanel.add(spin2)

        spin3 = JPanel(layout=BorderLayout(), opaque=False)
        self.time_shown_spinner = JSpinner(SpinnerNumberModel(
            self.view.time_shown, 0.01, 50, 0.1),
                                           stateChanged=self.time_shown)
        spin3.add(self.time_shown_spinner)
        spin3.add(JLabel('time shown'), BorderLayout.NORTH)
        spin3.maximumSize = spin3.preferredSize
        configPanel.add(spin3)

        layout = JPanel(layout=BorderLayout(), opaque=False)
        layout.add(
            JButton(icon=Icon.save,
                    rolloverIcon=ShadedIcon.save,
                    actionPerformed=self.save,
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False,
                    margin=java.awt.Insets(0, 0, 0, 0),
                    toolTipText='save layout'), BorderLayout.WEST)
        layout.add(
            JButton(icon=Icon.restore,
                    rolloverIcon=ShadedIcon.restore,
                    actionPerformed=self.restore,
                    borderPainted=False,
                    focusPainted=False,
                    contentAreaFilled=False,
                    margin=java.awt.Insets(0, 0, 0, 0),
                    toolTipText='restore layout'), BorderLayout.EAST)

        layout.add(
            JLabel('layout',
                   horizontalAlignment=javax.swing.SwingConstants.CENTER),
            BorderLayout.NORTH)
        layout.maximumSize = layout.preferredSize
        configPanel.add(layout)

        configPanel.setPreferredSize(
            java.awt.Dimension(20, self.config_panel_height))
        configPanel.visible = False

        for c in [dt, rate, spin1, spin2, spin3]:
            c.border = javax.swing.border.EmptyBorder(0, 10, 0, 10)
Beispiel #9
0
async def add(ctx, *, args):

    data.add(args, 'Users/' + str(ctx.message.author.id) + '.txt')
    print('added', args, 'to ' + str(ctx.message.author.id))
    await ctx.send(ctx.message.author.name + 'さんの課題を確かに受け取りました。')
Beispiel #10
0
async def addpublic(ctx, *, args):

    data.add(args, 'data.txt')
    print('added', args)

    await ctx.send('確かに受け取りました。')
Beispiel #11
0
cv_data = utils.retrieve_data("resume_data.txt")
sections = [section for section in cv_data]

working = True
while working:
    q1 = "Which section would you like to access? "
    r1 = utils.option_regulator(sections, q1)
    current_section = True
    while current_section:
        q2 = "What would you like to do in {}? ".format(r1)
        interactions = ["Create", "Edit", "Remove", "View", "Archive"]
        r2 = utils.option_regulator(interactions, q2)

        q3 = "Would you like to {} more entries? ".format(r2.lower())
        while r2 == "Create":
            data.add(cv_data[r1])
            r3 = utils.option_regulator(utils.y_n, q3)
            if r3 == "No":
                break
        while r2 == "Edit":
            data.edit(cv_data[r1])
            r3 = utils.option_regulator(utils.y_n, q3)
            if r3 == "No":
                break
        while r2 == "Remove":
            data.remove(cv_data[r1])
            r3 = utils.option_regulator(utils.y_n, q3)
            if r3 == "No":
                break
        while r2 == "View":
            data.view(cv_data[r1])
Beispiel #12
0
    def __init__(self,view):
        JPanel.__init__(self)
        self.view=view
        self.background=Color.white
        self.config_panel_height=60
        #self.config_panel_width = 675 
        
        
        mainPanel=JPanel(background=self.background,layout=BorderLayout())
        mainPanel.border=RoundedBorder()
        configPanel=JPanel(background=self.background,visible=False)
        


        self.layout=BorderLayout()
        self.add(mainPanel,BorderLayout.NORTH)        
        self.add(configPanel,BorderLayout.SOUTH)

        self.config_button=JButton(Icon.arrowdown,rolloverIcon=ShadedIcon.arrowdown,toolTipText='configure',actionPerformed=self.configure,borderPainted=False,focusPainted=False,contentAreaFilled=False)
        self.add(self.config_button)

        
        self.configPanel=configPanel
        
        
        
        self.slider=JSlider(0,1,0,background=self.background)          
        self.slider.snapToTicks=True
        mainPanel.add(self.slider)
        self.slider.addChangeListener(self)


        self.min_time=JLabel(' 0.0000 ',opaque=True,background=self.background)
        self.max_time=JLabel(' 0.0000 ',opaque=True,background=self.background)
        
        self.left_panel=JPanel(background=self.background)
        #self.config_button=JButton(Icon.configure,rolloverIcon=ShadedIcon.configure,toolTipText='configure',actionPerformed=self.configure,borderPainted=False,focusPainted=False,contentAreaFilled=False)
        self.left_panel.add(JButton(Icon.restart,rolloverIcon=ShadedIcon.restart,toolTipText='restart',actionPerformed=self.start,borderPainted=False,focusPainted=False,contentAreaFilled=False))
        self.left_panel.add(self.min_time)
        #self.left_panel.add(JButton(icon=Icon.backward,rolloverIcon=ShadedIcon.backward,toolTipText='backward one frame',actionPerformed=self.backward_one_frame))
        self.left_panel.add(JButton(icon=Icon.start,rolloverIcon=ShadedIcon.start,toolTipText='jump to beginning',actionPerformed=lambda x: self.slider.setValue(self.slider.minimum),borderPainted=False,focusPainted=False,contentAreaFilled=False))
                            
        self.right_panel=JPanel(background=self.background)
        #self.right_panel.add(JButton(icon=Icon.forward,rolloverIcon=ShadedIcon.forward,toolTipText='forward one frame',actionPerformed=self.forward_one_frame))
        self.right_panel.add(JButton(icon=Icon.end,rolloverIcon=ShadedIcon.end,toolTipText='jump to end',actionPerformed=lambda x: self.slider.setValue(self.slider.maximum),borderPainted=False,focusPainted=False,contentAreaFilled=False))
        self.right_panel.add(self.max_time)
        self.playpause_button=JButton(Icon.play,actionPerformed=self.pause,rolloverIcon=ShadedIcon.play,toolTipText='continue',borderPainted=False,focusPainted=False,contentAreaFilled=False)
        self.right_panel.add(self.playpause_button)



                             
        mainPanel.add(self.left_panel,BorderLayout.WEST)
        mainPanel.add(self.right_panel,BorderLayout.EAST)



        pdf=JPanel(layout=BorderLayout(),opaque=False)
        pdf.add(JButton(Icon.pdf,rolloverIcon=ShadedIcon.pdf,toolTipText='save pdf',actionPerformed=self.save_pdf,borderPainted=False,focusPainted=False,contentAreaFilled=False))
        pdf.add(JLabel('pdf',horizontalAlignment=javax.swing.SwingConstants.CENTER),BorderLayout.NORTH)
        pdf.maximumSize=pdf.preferredSize
        configPanel.add(pdf)

        
        data=JPanel(layout=BorderLayout(),opaque=False)
        data.add(JButton(Icon.data,rolloverIcon=ShadedIcon.data,toolTipText='examine data',actionPerformed=self.show_data,borderPainted=False,focusPainted=False,contentAreaFilled=False))
        data.add(JLabel('data',horizontalAlignment=javax.swing.SwingConstants.CENTER),BorderLayout.NORTH)
        data.maximumSize=data.preferredSize
        configPanel.add(data)


        mode=JPanel(layout=BorderLayout(),opaque=False)
        cb=JComboBox(['default','rate','direct'])
        if self.view.network.mode in [SimulationMode.DEFAULT,SimulationMode.PRECISE]:
            cb.setSelectedIndex(0)
        elif self.view.network.mode in [SimulationMode.RATE]:
            cb.setSelectedIndex(1)
        elif self.view.network.mode in [SimulationMode.DIRECT,SimulationMode.APPROXIMATE]:
            cb.setSelectedIndex(2)
        cb.addActionListener(self)
        self.mode_combobox=cb        
        mode.add(cb)
        mode.add(JLabel('mode'),BorderLayout.NORTH)
        mode.maximumSize=mode.preferredSize
        configPanel.add(mode)


        dt=JPanel(layout=BorderLayout(),opaque=False)
        cb=JComboBox(['0.001','0.0005','0.0002','0.0001'])
        cb.setSelectedIndex(0)
        self.view.dt=float(cb.getSelectedItem())
        cb.addActionListener(self)
        self.dt_combobox=cb        
        dt.add(cb)
        dt.add(JLabel('time step'),BorderLayout.NORTH)
        dt.maximumSize=dt.preferredSize
        configPanel.add(dt)

        rate=JPanel(layout=BorderLayout(),opaque=False)
        self.rate_combobox=JComboBox(['fastest','1x','0.5x','0.2x','0.1x','0.05x','0.02x','0.01x','0.005x','0.002x','0.001x'])
        self.rate_combobox.setSelectedIndex(4)
        self.view.set_target_rate(self.rate_combobox.getSelectedItem())
        self.rate_combobox.addActionListener(self)
        rate.add(self.rate_combobox)
        rate.add(JLabel('speed'),BorderLayout.NORTH)
        rate.maximumSize=rate.preferredSize
        configPanel.add(rate)


        spin1=JPanel(layout=BorderLayout(),opaque=False)
        self.record_time_spinner=JSpinner(SpinnerNumberModel((self.view.timelog.tick_limit-1)*self.view.dt,0.1,100,1),stateChanged=self.tick_limit)
        spin1.add(self.record_time_spinner)
        spin1.add(JLabel('recording time'),BorderLayout.NORTH)
        spin1.maximumSize=spin1.preferredSize
        configPanel.add(spin1)

        
        spin2=JPanel(layout=BorderLayout(),opaque=False)
        self.filter_spinner = JSpinner(SpinnerNumberModel(self.view.tau_filter,0,0.5,0.01),stateChanged=self.tau_filter)
        spin2.add(self.filter_spinner)
        spin2.add(JLabel('filter'),BorderLayout.NORTH)
        spin2.maximumSize=spin2.preferredSize
        configPanel.add(spin2)

        spin3=JPanel(layout=BorderLayout(),opaque=False)
        self.time_shown_spinner = JSpinner(SpinnerNumberModel(self.view.time_shown,0.01,50,0.1),stateChanged=self.time_shown)
        spin3.add(self.time_shown_spinner)
        spin3.add(JLabel('time shown'),BorderLayout.NORTH)
        spin3.maximumSize=spin3.preferredSize
        configPanel.add(spin3)
        
        
        layout=JPanel(layout=BorderLayout(),opaque=False)
        layout.add(JButton(icon=Icon.save,rolloverIcon=ShadedIcon.save,actionPerformed=self.save,borderPainted=False,focusPainted=False,contentAreaFilled=False,margin=java.awt.Insets(0,0,0,0),toolTipText='save layout'),BorderLayout.WEST)
        layout.add(JButton(icon=Icon.restore,rolloverIcon=ShadedIcon.restore,actionPerformed=self.restore,borderPainted=False,focusPainted=False,contentAreaFilled=False,margin=java.awt.Insets(0,0,0,0),toolTipText='restore layout'),BorderLayout.EAST)
        
        layout.add(JLabel('layout',horizontalAlignment=javax.swing.SwingConstants.CENTER),BorderLayout.NORTH)
        layout.maximumSize=layout.preferredSize
        configPanel.add(layout)



        
        configPanel.setPreferredSize(java.awt.Dimension(20,self.config_panel_height))
        configPanel.visible=False
        
        
        for c in [dt,rate,spin1,spin2,spin3]:
            c.border=javax.swing.border.EmptyBorder(0,10,0,10)
Beispiel #13
0
def get_base_environment(variables=None, *args, **kw):
    """Create an environment suitable for building IMP modules"""
    #import colorizer
    # First make a dummy environment in order to evaluate all variables, since
    # env['wine'] will tell us which 'real' environment to create:
    env = Environment(tools=[], variables=variables)
    #variables.Update(env)
    newpath = env['ENV']['PATH']
    if env.get('path') is not None:
        newpath = env['path'] + os.path.pathsep + newpath
    envargs={'PATH':newpath}

#If the output is not a terminal, remove the colors
    if env['wine']:
        env = _WineEnvironment(variables=variables,
                              ENV = {'PATH':newpath},
                              *args, **kw)
    else:
        env = Environment(variables=variables,
                          ENV = {'PATH':newpath},
                          *args, **kw)
        #env['PYTHON'] = 'python'
    data.add(env)
    impvariables.update(env, variables)
    colors = {}
    colors['cyan']   = '\033[96m'
    colors['purple'] = '\033[95m'
    colors['blue']   = '\033[94m'
    colors['green']  = '\033[92m'
    colors['yellow'] = '\033[93m'
    colors['red']    = '\033[91m'
    colors['end']    = '\033[0m'
    env['IMP_COLORS']=colors
    if not env['color'] or "TERM" not in os.environ.keys()\
            or os.environ["TERM"] != "xterm":
        for key, value in colors.iteritems():
            colors[key] = ''
    if env['pretty']:
        compile_source_message = '%sCompiling %s$TARGET%s' % \
            (colors['blue'], colors['end'], colors['end'])

        compile_shared_source_message = '%sCompiling shared %s$TARGET%s' % \
            (colors['blue'], colors['end'], colors['end'])

        link_program_message = '%sLinking Program %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        link_library_message = '%sLinking Static Library %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        ranlib_library_message = '%sRanlib Library %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        link_shared_library_message = '%sLinking Shared Library %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        link_module_message = '%sLinking Shared Module %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        java_library_message = '%sCreating Java Archive %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        swig_message = '%sRunning swig on %s$TARGET%s' % \
            (colors['purple'], colors['end'], colors['end'])

        pretty={'CXXCOMSTR': compile_source_message,
                'CCCOMSTR': compile_source_message,
                'SHCCCOMSTR': compile_shared_source_message,
                'SHCXXCOMSTR': compile_shared_source_message,
                'ARCOMSTR': link_library_message,
                'RANLIBCOMSTR': ranlib_library_message,
                'SHLINKCOMSTR': link_shared_library_message,
                'LDMODCOMSTR': link_module_message,
                'LINKCOMSTR': link_program_message,
                'JARCOMSTR': java_library_message,
                'JAVACCOMSTR': compile_source_message,
                'SWIGCOMSTR': swig_message,}
        for p in pretty.keys():
            env[p]=pretty[p]
    if env['IMP_USE_PLATFORM_FLAGS']:
        _fix_include_path(env)
        _add_platform_flags(env)
    #col = colorizer.colorizer()
    #col.colorize(env)
    env['PYTHONPATH'] = '#/build/lib'
    if env.get('pythonpath', None):
        env['PYTHONPATH'] = os.path.pathsep.join(['#/build/lib']+[env['PYTHONPATH']])
    env['all_modules']=[]
    #env.Decider('MD5-timestamp')

    dependency.boost.configure_env_for_auto_link(env)

    # Make Modeller exetype variable available:
    if os.environ.has_key('EXECUTABLE_TYPESVN'):
        env['ENV']['EXECUTABLE_TYPESVN'] = os.environ['EXECUTABLE_TYPESVN']
    # Set empty variables in case the Modeller check fails:
    for mod in ('MODPY', 'EXETYPE'):
        env['MODELLER_' + mod] = ''
    for mod in ('CPPPATH', 'LIBPATH', 'LIBS'):
        env['MODELLER_' + mod] = []
    dependency.compilation.configure_check(env)
    dependency.nullptr.configure_check(env)
    if platform == 'aix':
        # Make sure compilers are in the PATH, so that Python's script for
        # building AIX extension modules can find them:
        e['ENV']['PATH'] += ':/usr/vac/bin'
    #print "cxx", env['CXXFLAGS']
    env.Prepend(CPPPATH=[Dir('#/build/include').abspath])
    env.Prepend(LIBPATH=[Dir('#/build/lib').abspath])
    env.Append(BUILDERS={'IMPRun': run.Run})
    # these should be in application, but...
    env.AddMethod(application.IMPApplication)
    env.AddMethod(application.IMPCPPExecutable)
    env.AddMethod(application.IMPCPPExecutables)
    env.AddMethod(application.IMPApplicationTest)
    env.AddMethod(application.IMPPythonExecutable)

    # these should be in systems
    env.AddMethod(biology.IMPSystem)

    # these should be in the module, but this seems to speed things up
    env.AddMethod(module.IMPModuleBuild)
    env.AddMethod(module.IMPModuleLib)
    env.AddMethod(module.IMPModuleInclude)
    env.AddMethod(module.IMPModuleData)
    env.AddMethod(module.IMPModulePython)
    env.AddMethod(module.IMPModuleTest)
    env.AddMethod(module.IMPModuleBuild)
    env.AddMethod(module.IMPModuleGetHeaders)
    env.AddMethod(module.IMPModuleGetExamples)
    env.AddMethod(module.IMPModuleGetExampleData)
    env.AddMethod(module.IMPModuleGetPythonTests)
    env.AddMethod(module.IMPModuleGetExpensivePythonTests)
    env.AddMethod(module.IMPModuleGetCPPTests)
    env.AddMethod(module.IMPModuleGetData)
    env.AddMethod(module.IMPModuleGetSources)
    env.AddMethod(module.IMPModuleGetPython)
    env.AddMethod(module.IMPModuleGetSwigFiles)
    env.AddMethod(module.IMPModuleGetBins)
    env.AddMethod(module.IMPModuleGetBenchmarks)
    env.AddMethod(module.IMPModuleBin)
    env.AddMethod(module.IMPModuleBenchmark)
    env.AddMethod(module.IMPModuleDoc)
    env.AddMethod(module.IMPModuleExamples)
    env.AddMethod(module.IMPModuleGetDocs)
    env.AddMethod(doc.IMPPublication)
    env.AddMethod(doc.IMPWebsite)
    env.AddMethod(doc.IMPStandardPublications)
    env.AddMethod(doc.IMPStandardLicense)
    env.Append(BUILDERS={'IMPModuleCPPTest': test.CPPTestHarness})
    env.Append(BUILDERS={'IMPModuleSWIG': module._swig.get_swig_action(env)})
    env.Append(BUILDERS={'IMPModulePatchSWIG': module._swig.PatchSwig})
    env.Append(BUILDERS={'IMPModuleSWIGPreface': module._swig.SwigPreface})
    env.Append(BUILDERS = {'IMPModuleVersionH': module._version_h.VersionH,
                           'IMPModuleConfigH': module._config_h.ConfigH,
                           'IMPModuleConfigCPP': module._config_h.ConfigCPP,
                           'IMPModuleLinkTest': module._link_test.LinkTest})
    if env.get('linkflags', None):
        env.Append(LINKFLAGS=env['linkflags'])
    return env