Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2008-05

Register Package Help

17 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Lee Jenkins

Hi all,

I'm trying to create a package to that contains a unit which defines a TShape descendant component following this example:

http://wiki.lazarus.freepascal.org/Lazarus_Packages#Adding_existing_components_to_a_Package

The problem that I'm having is that package overwrites the .pas file that I include with:

{ This file was automatically created by Lazarus. Do not edit! This source is only used to compile and install the package. }

unit pos_button;
interface
uses
   pos_button, LazarusPackageIntf;
implementation
procedure Register;
begin
   RegisterUnit( 'pos_button', at pos_button.Register) ;
end;
initialization
   RegisterPackage( 'pos_button', at Register) ;
end.

Before trying to save/compile the package this source file contains the source for the component. After save/compile the contents are replaced with the above source.

Warm Regards, Lee

Reply by email

Lee Jenkins
to cyberpython
cyberpython wrote
Try renaming (saving) your package to TPos_button.

Thanks, that got me a bit further, but now when I try to compile the package I get error saying that Graphics unit cannot be found located in my component's .pas file. Yet, if I compile the unit without the package, it compile fine (For instance, if I add it to an existing package).

Warm Regards, Lee

Reply by email

Lee Jenkins
to Lee Jenkins
Lee Jenkins wrote 9 lines
cyberpython wrote: > Try renaming (saving) your package to TPos_button. > Thanks, that got me a bit further, but now when I try to compile the package I get error saying that Graphics unit cannot be found located in my component's .pas file. Yet, if I compile the unit without the package, it compile fine (For instance, if I add it to an existing package).

Never mind, I thought LCL was implicitly added as a requirement.

Thanks,

Warm Regards, Lee

Reply by email

Mattias Gaertner
to Lee Jenkins: I'm trying to create a package to that contains a unit which defines a TShape descendant…
Show quoted text 9 lines
Hi all, I'm trying to create a package to that contains a unit which defines a TShape descendant component following this example: http://wiki.lazarus.freepascal.org/Lazarus_Packages#Adding_existing_components_to_a_Package The problem that I'm having is that package overwrites the .pas file that I include with:

You named the package the same as the unit.
The IDE should not allow this. Please create a bug report and explain how you did that. Did you create a new package, added the file and then saved the package?

Show quoted text 8 lines
{ This file was automatically created by Lazarus. Do not edit! This source is only used to compile and install the package. } [...] Before trying to save/compile the package this source file contains the source for the component. After save/compile the contents are replaced with the above source.

Mattias

Reply by email

Lee Jenkins
to Mattias Gaertner
Mattias Gaertner wrote 17 lines
On Thu, 01 May 2008 09:59:08 -0400 Lee Jenkins wrote: > Hi all, > > I'm trying to create a package to that contains a unit which defines > a TShape descendant component following this example: > > http://wiki.lazarus.freepascal.org/Lazarus_Packages#Adding_existing_components_to_a_Package > > The problem that I'm having is that package overwrites the .pas file > that I include with: You named the package the same as the unit. The IDE should not allow this. Please create a bug report and explain how you did that. Did you create a new package, added the file and then saved the package?

Actually, I have yet to get my password from the bug tracker and I have been lazy in not creating a new profile which I'll do after writing this email :)

The unit source name is:

pos_button.pas

I named the .lpk file:

posbutton.lpk

I figured that the names should not be exact, but I suppose that the IDE somehow stripped the underscore ?

At any rate,

1. I created the source file first.

2. Create the packages and added through "Add Unit" tab.

3. Saved the lpk file as posbutton.lpk

4. Compiled it and that is when it overwrote my source file.

Warm Regards, Lee

Reply by email

Mattias Gaertner
to Lee Jenkins
Show quoted text 43 lines
Mattias Gaertner wrote: > On Thu, 01 May 2008 09:59:08 -0400 > Lee Jenkins wrote: > >> Hi all, >> >> I'm trying to create a package to that contains a unit which >> defines a TShape descendant component following this example: >> >> http://wiki.lazarus.freepascal.org/Lazarus_Packages#Adding_existing_components_to_a_Package >> >> The problem that I'm having is that package overwrites the .pas >> file that I include with: > > You named the package the same as the unit. > The IDE should not allow this. Please create a bug report and > explain how you did that. Did you create a new package, added the > file and then saved the package? Actually, I have yet to get my password from the bug tracker and I have been lazy in not creating a new profile which I'll do after writing this email :) The unit source name is: pos_button.pas I named the .lpk file: posbutton.lpk I figured that the names should not be exact, but I suppose that the IDE somehow stripped the underscore ? At any rate, 1. I created the source file first. 2. Create the packages and added through "Add Unit" tab. 3. Saved the lpk file as posbutton.lpk 4. Compiled it and that is when it overwrote my source file.

Here it works. That means, it does not strip the underscore. The only place where underscores are stripped are in the widgetsets for labels. I don't see any relationship.
Can you reproduce it?

I added a check in svn 15029 to forbid naming a package as a unit.

Mattias

Reply by email

Lee Jenkins
to Mattias Gaertner
Mattias Gaertner wrote 53 lines
On Thu, 01 May 2008 19:48:52 -0400 Lee Jenkins wrote: > Mattias Gaertner wrote: >> On Thu, 01 May 2008 09:59:08 -0400 >> Lee Jenkins wrote: >> >>> Hi all, >>> >>> I'm trying to create a package to that contains a unit which >>> defines a TShape descendant component following this example: >>> >>> http://wiki.lazarus.freepascal.org/Lazarus_Packages#Adding_existing_components_to_a_Package >>> >>> The problem that I'm having is that package overwrites the .pas >>> file that I include with: >> You named the package the same as the unit. >> The IDE should not allow this. Please create a bug report and >> explain how you did that. Did you create a new package, added the >> file and then saved the package? > Actually, I have yet to get my password from the bug tracker and I > have been lazy in not creating a new profile which I'll do after > writing this email :) > > The unit source name is: > > pos_button.pas > > I named the .lpk file: > > posbutton.lpk > > I figured that the names should not be exact, but I suppose that the > IDE somehow stripped the underscore ? > > At any rate, > > 1. I created the source file first. > > 2. Create the packages and added through "Add Unit" tab. > > 3. Saved the lpk file as posbutton.lpk > > 4. Compiled it and that is when it overwrote my source file. Here it works. That means, it does not strip the underscore. The only place where underscores are stripped are in the widgetsets for labels. I don't see any relationship. Can you reproduce it? I added a check in svn 15029 to forbid naming a package as a unit. Mattias

Mattias,

Is this included in snapshots? I have problems when trying to build from sources on Windows, but I'll download the latest snapshot this weekend and give it a go again and see if I can get it to replicate the problem or not.

Thanks a bunch for your help.

Warm Regards, Lee

Reply by email

Mattias Gaertner
to Lee Jenkins
Show quoted text 26 lines
[...] >> The unit source name is: >> >> pos_button.pas >> >> I named the .lpk file: >> >> posbutton.lpk >> >> I figured that the names should not be exact, but I suppose that >> the IDE somehow stripped the underscore ? >> >> At any rate, >> >> 1. I created the source file first. >> >> 2. Create the packages and added through "Add Unit" tab. >> >> 3. Saved the lpk file as posbutton.lpk >> >> 4. Compiled it and that is when it overwrote my source file. > > Here it works. That means, it does not strip the underscore. The > only place where underscores are stripped are in the widgetsets for > labels. I don't see any relationship. > Can you reproduce it?

Any news?

Show quoted text 8 lines
> I added a check in svn 15029 to forbid naming a package as a unit. Mattias, Is this included in snapshots? I have problems when trying to build from sources on Windows, but I'll download the latest snapshot this weekend and give it a go again and see if I can get it to replicate the problem or not.

Snapshots are built daily.

Mattias

Reply by email

Lee Jenkins
to Mattias Gaertner
Mattias Gaertner wrote 42 lines
On Fri, 02 May 2008 09:09:04 -0400 Lee Jenkins wrote: > [...] >>> The unit source name is: >>> >>> pos_button.pas >>> >>> I named the .lpk file: >>> >>> posbutton.lpk >>> >>> I figured that the names should not be exact, but I suppose that >>> the IDE somehow stripped the underscore ? >>> >>> At any rate, >>> >>> 1. I created the source file first. >>> >>> 2. Create the packages and added through "Add Unit" tab. >>> >>> 3. Saved the lpk file as posbutton.lpk >>> >>> 4. Compiled it and that is when it overwrote my source file. >> Here it works. That means, it does not strip the underscore. The >> only place where underscores are stripped are in the widgetsets for >> labels. I don't see any relationship. >> Can you reproduce it? Any news? >> I added a check in svn 15029 to forbid naming a package as a unit. > Mattias, > > Is this included in snapshots? I have problems when trying to build > from sources on Windows, but I'll download the latest snapshot this > weekend and give it a go again and see if I can get it to replicate > the problem or not. Snapshots are built daily.

It seems that page that hosts the snapshots
(http://www.hu.freepascal.org/lazarus/) is down right now, at least from where I am. I'll try to grab the latest later today/tonight and try.

Thanks,

Warm Regards, Lee "When my company started out, we were really, really, really, really small. Now...we're just really small."

Reply by email

Damien Gerard
to Lee Jenkins

Le May 2, 2008 ? 5:46 PM, Lee Jenkins a ?crit :

Show quoted text 49 lines
Mattias Gaertner wrote: > On Fri, 02 May 2008 09:09:04 -0400 > Lee Jenkins wrote: > >> [...] >>>> The unit source name is: >>>> >>>> pos_button.pas >>>> >>>> I named the .lpk file: >>>> >>>> posbutton.lpk >>>> >>>> I figured that the names should not be exact, but I suppose that >>>> the IDE somehow stripped the underscore ? >>>> >>>> At any rate, >>>> >>>> 1. I created the source file first. >>>> >>>> 2. Create the packages and added through "Add Unit" tab. >>>> >>>> 3. Saved the lpk file as posbutton.lpk >>>> >>>> 4. Compiled it and that is when it overwrote my source file. >>> Here it works. That means, it does not strip the underscore. The >>> only place where underscores are stripped are in the widgetsets for >>> labels. I don't see any relationship. >>> Can you reproduce it? > > Any news? > > >>> I added a check in svn 15029 to forbid naming a package as a unit. >> Mattias, >> >> Is this included in snapshots? I have problems when trying to build >> from sources on Windows, but I'll download the latest snapshot this >> weekend and give it a go again and see if I can get it to replicate >> the problem or not. > > Snapshots are built daily. > It seems that page that hosts the snapshots (http://www.hu.freepascal.org/lazarus/) is down right now, at least from where I am. I'll try to grab the latest later today/tonight and try.

Others mirrors are available :
http://wiki.lazarus.freepascal.org/Lazarus_Snapshots_Downloads

This one is up :
http://snapshots.lazarus.shikami.org/lazarus/

Show quoted text 15 lines
Thanks, -- Warm Regards, Lee "When my company started out, we were really, really, really, really small. Now...we're just really small." _______________________________________________ Lazarus mailing list http://www.lazarus.freepascal.org/mailman/listinfo/lazarus
Damien Gerard "Intelligence is 10 million rules." -- Douglas Lenat

Reply by email

Stephano
to Mattias Gaertner: On Thu, 01 May 2008 09:59:08 -0400 You named the package the same as the unit. The IDE…
Mattias Gaertner wrote
You named the package the same as the unit. The IDE should not allow this. Please create a bug report and explain how you did that. Did you create a new package, added the file and then saved the package?

Well the IDE allows it AFAIK. I encountered this bug a long time ago by creating a new package with a unit, and saving the package (Save or Save As??) with the same name as that of the unit. Hadn't I had a backup, I would have lost the unit altogether as the IDE happily replaced my unit without warning. The bug tracker was down then, and I forgot later on about the issue.

HTH

Reply by email

Lee Jenkins
to Damien Gerard: Le May 2, 2008 ? 5:46 PM, Lee Jenkins a ?crit : Others mirrors are available :…
Damien Gerard wrote 23 lines
Le May 2, 2008 ? 5:46 PM, Lee Jenkins a ?crit : >>>> I added a check in svn 15029 to forbid naming a package as a unit. >>> Mattias, >>> >>> Is this included in snapshots? I have problems when trying to build >>> from sources on Windows, but I'll download the latest snapshot this >>> weekend and give it a go again and see if I can get it to replicate >>> the problem or not. >> Snapshots are built daily. >> > It seems that page that hosts the snapshots > (http://www.hu.freepascal.org/lazarus/) is down right now, at least > from where I > am. I'll try to grab the latest later today/tonight and try. > Others mirrors are available : http://wiki.lazarus.freepascal.org/Lazarus_Snapshots_Downloads This one is up : http://snapshots.lazarus.shikami.org/lazarus/

Downloading now. Thanks Damien.

Warm Regards, Lee

Reply by email

Lee Jenkins
to Mattias Gaertner: On Fri, 02 May 2008 09:09:04 -0400 Any news? Snapshots are built daily. Mattias
Mattias Gaertner wrote 42 lines
On Fri, 02 May 2008 09:09:04 -0400 Lee Jenkins wrote: > [...] >>> The unit source name is: >>> >>> pos_button.pas >>> >>> I named the .lpk file: >>> >>> posbutton.lpk >>> >>> I figured that the names should not be exact, but I suppose that >>> the IDE somehow stripped the underscore ? >>> >>> At any rate, >>> >>> 1. I created the source file first. >>> >>> 2. Create the packages and added through "Add Unit" tab. >>> >>> 3. Saved the lpk file as posbutton.lpk >>> >>> 4. Compiled it and that is when it overwrote my source file. >> Here it works. That means, it does not strip the underscore. The >> only place where underscores are stripped are in the widgetsets for >> labels. I don't see any relationship. >> Can you reproduce it? Any news? >> I added a check in svn 15029 to forbid naming a package as a unit. > Mattias, > > Is this included in snapshots? I have problems when trying to build > from sources on Windows, but I'll download the latest snapshot this > weekend and give it a go again and see if I can get it to replicate > the problem or not. Snapshots are built daily.

I downloaded latest snapshot, Mattias. I was unable to get replicate the problem with using the underscore and it create the package as was expected.

However, I then tried to create a package with the same name as the unit that contained the component, "pos_button.pas" and "pos_button.lpk". Saved, the package, added "pos_button.pas" to the package. Saved, compiled and it did overwrite the "pos_button.pas" file.

I have downloaded and tried this with:
Lazarus-0.9.25-fpc-2.2.1-20080501-win32.exe

Warm Regards, Lee "When my company started out, we were really, really, really, really small. Now...we're just really small."

Reply by email

Mattias Gaertner
to Stephano: Well the IDE allows it AFAIK. I encountered this bug a long time ago by creating a new…
Show quoted text 11 lines
Mattias Gaertner wrote: > You named the package the same as the unit. > The IDE should not allow this. Please create a bug report and > explain how you did that. Did you create a new package, added the > file and then saved the package? Well the IDE allows it AFAIK. I encountered this bug a long time ago by creating a new package with a unit, and saving the package (Save or Save As??) with the same name as that of the unit. Hadn't I had a backup, I would have lost the unit altogether as the IDE happily replaced my unit without warning. The bug tracker was down then, and I forgot later on about the issue.

No need for the bug report. I already added a check to the IDE.

Mattias

Reply by email

Mattias Gaertner
to Lee Jenkins: I downloaded latest snapshot, Mattias. I was unable to get replicate the problem with…
Show quoted text 15 lines
[...] >>> I added a check in svn 15029 to forbid naming a package as a unit. >> Mattias, >> >> Is this included in snapshots? I have problems when trying to >> build from sources on Windows, but I'll download the latest >> snapshot this weekend and give it a go again and see if I can get >> it to replicate the problem or not. > > Snapshots are built daily. > I downloaded latest snapshot, Mattias. I was unable to get replicate the problem with using the underscore and it create the package as was expected.

Good.

Show quoted text 8 lines
However, I then tried to create a package with the same name as the unit that contained the component, "pos_button.pas" and "pos_button.lpk". Saved, the package, added "pos_button.pas" to the package. Saved, compiled and it did overwrite the "pos_button.pas" file. I have downloaded and tried this with: Lazarus-0.9.25-fpc-2.2.1-20080501-win32.exe

It is not yet in the current snapshot. It will be in the next. Snapshots are only built daily.

Mattias

Reply by email

Lee Jenkins
to Mattias Gaertner
Mattias Gaertner wrote 30 lines
On Fri, 02 May 2008 13:11:14 -0400 Lee Jenkins wrote: > [...] >>>> I added a check in svn 15029 to forbid naming a package as a unit. >>> Mattias, >>> >>> Is this included in snapshots? I have problems when trying to >>> build from sources on Windows, but I'll download the latest >>> snapshot this weekend and give it a go again and see if I can get >>> it to replicate the problem or not. >> Snapshots are built daily. >> > I downloaded latest snapshot, Mattias. I was unable to get replicate > the problem with using the underscore and it create the package as > was expected. Good. > However, I then tried to create a package with the same name as the > unit that contained the component, "pos_button.pas" and > "pos_button.lpk". Saved, the package, added "pos_button.pas" to the > package. Saved, compiled and it did overwrite the "pos_button.pas" > file. > > I have downloaded and tried this with: > Lazarus-0.9.25-fpc-2.2.1-20080501-win32.exe It is not yet in the current snapshot. It will be in the next. Snapshots are only built daily.

Ah, time difference misunderstanding here. I'll try it again with (my) tomorrow's snapshot. ;)

Warm Regards, Lee "When my company started out, we were really, really, really, really small. Now...we're just really small."

Reply by email